Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

File to delete flash drive files

Is there any way to code a file that if it's ran it will delete all the files on the flash drive regardless of what computer it's plugged into?
(Jul 19, 2017 09:00 PM)GG Luck GG Wrote:  Is there any way to code a file that if it's ran it will delete all the files on the flash drive regardless of what computer it's plugged into?
Hi ✌
Why you need a such descrutive code like that ? what's your aim ?
Code below scan all drives on PC and remove all files/folders (hidden and read-only incl.) only from removable drives.

Code
@echo off
for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do (
   for %%c in (%%b) do (
      for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do (
         if %%d equ Removable (
            cd /d %%c
            attrib -r -s -h /S /D
            for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
         )
      )
   )
)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by bladetest21May 14, 2020 10:45 AM 19 791 May 14, 2020 10:45 AM
Last Post: gogglebot
[Java] by mattFeb 3, 2017 02:48 PM 0 162 Feb 3, 2017 02:48 PM
Last Post: matt
[Shell] by missNasserJan 20, 2017 02:32 PM 1 99 Jan 20, 2017 02:32 PM
Last Post: DataBuster