Windows Thread, Delete All Files and Folders Inside a Directory? in Technical; The school has a Functional Skills exam coming up and I need to delete the contents of the exam users ...
19th June 2013, 12:25 PM #1
Delete All Files and Folders Inside a Directory?
The school has a Functional Skills exam coming up and I need to delete the contents of the exam users folders. I have tried the following command but it only deletes files and not folders. Is there anyway I can force it to delete everything?
I don't want to delete the top level folder (i.e. Exam51, 52 etc) just empty out the contents.
DEL /Q /S "E:\Users\ExamUsers\Exam51\*.*"
DEL /Q /S "E:\Users\ExamUsers\Exam52\*.*"
DEL /Q /S "E:\Users\ExamUsers\Exam53\*.*"
19th June 2013, 12:28 PM #2
Just a quick and dirty way you could use robocopy
robocopy "source" "E:\Users\ExamUsers\Exam51" /MIR
robocopy "source" "E:\Users\ExamUsers\Exam52" /MIR
Make the source folder empty.
We use this for sending files to the functional skills home areas, so might be handy for that.
Thanks to FN-GM from:
Zoom7000 (19th June 2013)
19th June 2013, 12:28 PM #3
Del only does files. Think it's RD for folders?
e.g. RD /S /Q "path"
19th June 2013, 12:40 PM #4
Thanks, I will try that!
Originally Posted by FN-GM
I've tried RD, but it removes the root folder too! Don't want that! :P
Originally Posted by Steve21
19th June 2013, 12:41 PM #5
Thanks FN-GM. That worked perfectly!
Last Post: 1st July 2014, 09:34 AM
Last Post: 6th January 2009, 01:11 PM
By originofsymmetry in forum Scripts
Last Post: 2nd October 2007, 01:16 PM
By sandfie in forum Windows
Last Post: 26th March 2007, 11:45 PM
By BKGarry in forum Windows
Last Post: 15th November 2006, 04:19 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)