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, 11:25 AM #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, 11:28 AM #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, 11:28 AM #3
Del only does files. Think it's RD for folders?
e.g. RD /S /Q "path"
19th June 2013, 11:40 AM #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, 11:41 AM #5
Thanks FN-GM. That worked perfectly!
Last Post: 1st July 2014, 08:34 AM
Last Post: 6th January 2009, 12:11 PM
By originofsymmetry in forum Scripts
Last Post: 2nd October 2007, 12:16 PM
By sandfie in forum Windows
Last Post: 26th March 2007, 10:45 PM
By BKGarry in forum Windows
Last Post: 15th November 2006, 03:19 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)