SavefileArchive
USD/IDR ...
|
BTC ...
|
ETH ...
|
GOLD/gram ...
Terbaru
SavefileArchive — Tutorial coding, tips programming, dan dunia musik untuk developer & pecinta musik Indonesia

batch remove folder windows

 

save as file_remove.bat
------------------------------------------------------------------------ 
@echo off REM Iterate over all folders in the current directory that start with "AA" for /d %%d in (AA*) do ( rmdir /s /q /verbose "%%d" ) --------------------------------------------------------------------------

Here's how the script works with the /verbose option:

  1. The for loop iterates over all directories in the current directory that have names starting with "AA".

  2. The rmdir command is used to delete each directory and all of its contents, and the /verbose option is used to show more information about the deletion process.

  3. The /s option is used to delete the directory and all of its subdirectories and files.

  4. The /q option is used to delete the directory without asking for confirmation.

The /verbose option will display a message for each folder that is being deleted, indicating the name of the folder and the number of files and directories that are being deleted. This can be helpful for troubleshooting and debugging purposes.

 

 To delete all folders in the current directory that start with the letters "AA", "BB", or "AB", you can modify the for command to include multiple patterns. Here's the modified batch file that does this:

--------------------------------------------------------------------------------

@echo off

REM Iterate over all folders in the current directory that start with "AA", "BB", or "AB"
for /d %%d in (AA*,BB*,AB*) do (

    REM Delete the folder and all of its contents
    rmdir /s /q "%%d"
)

REM Pause for demonstration purposes
pause
 
--------------------------------------------------------------------------------