This code that does not work:
@echo off if exist output @set /p checkdir= Output directory found. Do you wish to overwrite it?: if /I %checkdir% == Y deltree /s /output pause
Answer: Use the rm Command Both commands will have the same effect, because current working directory doesn't matter when you use absolute path. Any path that starts with a forward slash / is an absolute path. The options have the following meanings: -r : Recursive remove.
To permanently remove a directory in Linux, use either rmdir or rm command: For empty directories, use rmdir [dirname] or rm -d [dirname] For non-empty directories, use rm -r [dirname]
You were looking for this command:
RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with /S
In your case just use /S ,it will delete the whole directory tree by first asking the user if it should proceed, i.e.- displaying the following output to the screen:
"folderName, Are you sure (Y/N)?"
where folderName
is the name of the folder (and its sub-folders) you wish to remove.
Tested on Windows 7, 64 bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With