Timeline for How can I delete all files/subfolders in a given folder via the command prompt?
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 31, 2022 at 9:56 | review | Suggested edits | |||
Jan 31, 2022 at 17:01 | |||||
Dec 18, 2018 at 8:02 | review | Suggested edits | |||
Dec 18, 2018 at 8:46 | |||||
Apr 5, 2018 at 11:51 | review | Suggested edits | |||
Apr 5, 2018 at 12:15 | |||||
Apr 5, 2018 at 4:27 | comment | added | Hashim Aziz |
Can confirm rmdir deletes the parent directory - not sure what HSuke is talking about in that regard, but the del command does seem redundant here.
|
|
Jan 12, 2018 at 10:18 | comment | added | Ishmaeel | Real dangerous. If somebody goes ahead and removes/renames `C:\Users\Desktop\New folder`, the very first line with CD fails and your batch file happily deletes everything in the current (default) directory. Which could very well end up being your working directory or C:\Windows\System32 | |
Nov 16, 2017 at 18:58 | comment | added | HSuke | No. This actually works at completely clearing the "New folder" without deleting the folder itself. The only issue is that it gives a minor warning when the OS fails to delete the parent folder. Also, the del command is redundant unless you have a large folder, in which case it might be faster. You could just modify it as such (Sorry about the lack of line breaks in comments): set FOLDER="%userprofile%\Desktop\New folder" cd %FOLDER% rmdir /S /Q %FOLDER%\ >nul 2>&1 | |
Apr 6, 2017 at 21:18 | comment | added | Navigatron |
As @Tony_Henrich said the rmdir command will delete New folder
|
|
Dec 4, 2016 at 5:51 | comment | added | Tony_Henrich | Not good. Hard coded paths and by looking at it, it doesn't empty the folder. It removes it. Very dangerous also. It deletes files at the current folder if the path doesn't exit or mispelled. | |
Nov 4, 2016 at 22:43 | review | Suggested edits | |||
Nov 5, 2016 at 2:37 | |||||
Aug 25, 2016 at 18:44 | comment | added | Jerther | Works very well, except for a warning when the system cannot delete the root folder. | |
S Oct 5, 2013 at 10:16 | history | suggested | BlueBerry - Vignesh4303 | CC BY-SA 3.0 |
formatting
|
Oct 5, 2013 at 7:48 | review | Suggested edits | |||
S Oct 5, 2013 at 10:16 | |||||
S Oct 5, 2013 at 5:00 | review | Late answers | |||
Oct 5, 2013 at 7:49 | |||||
S Oct 5, 2013 at 5:00 | review | First posts | |||
Oct 5, 2013 at 5:22 | |||||
Oct 5, 2013 at 4:44 | history | answered | Annasaheb | CC BY-SA 3.0 |