+ Post New Thread
Results 1 to 5 of 5
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 ...
  1. #1
    Zoom7000's Avatar
    Join Date
    Feb 2006
    Location
    London
    Posts
    942
    Thank Post
    306
    Thanked 83 Times in 54 Posts
    Rep Power
    33

    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?

    Code:
    DEL /Q /S "E:\Users\ExamUsers\Exam51\*.*"
    DEL /Q /S "E:\Users\ExamUsers\Exam52\*.*"
    DEL /Q /S "E:\Users\ExamUsers\Exam53\*.*"
    
    Etc..
    I don't want to delete the top level folder (i.e. Exam51, 52 etc) just empty out the contents.

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,971
    Thank Post
    886
    Thanked 1,715 Times in 1,481 Posts
    Blog Entries
    12
    Rep Power
    450
    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.

  3. Thanks to FN-GM from:

    Zoom7000 (19th June 2013)

  4. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Del only does files. Think it's RD for folders?

    e.g. RD /S /Q "path"

    Steve

  5. #4
    Zoom7000's Avatar
    Join Date
    Feb 2006
    Location
    London
    Posts
    942
    Thank Post
    306
    Thanked 83 Times in 54 Posts
    Rep Power
    33
    Quote Originally Posted by FN-GM View Post
    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, I will try that!

    Quote Originally Posted by Steve21 View Post
    Del only does files. Think it's RD for folders?

    e.g. RD /S /Q "path"

    Steve
    I've tried RD, but it removes the root folder too! Don't want that! :P

  6. #5
    Zoom7000's Avatar
    Join Date
    Feb 2006
    Location
    London
    Posts
    942
    Thank Post
    306
    Thanked 83 Times in 54 Posts
    Rep Power
    33
    Thanks FN-GM. That worked perfectly!

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 5
    Last Post: 1st July 2014, 08:34 AM
  2. Empty files and folders on a shared area
    By ranj in forum Windows
    Replies: 6
    Last Post: 6th January 2009, 12:11 PM
  3. Mass Copy of Files and Folders
    By originofsymmetry in forum Scripts
    Replies: 6
    Last Post: 2nd October 2007, 12:16 PM
  4. Restrict "Search files and folders"
    By sandfie in forum Windows
    Replies: 4
    Last Post: 26th March 2007, 10:45 PM
  5. Replies: 4
    Last Post: 15th November 2006, 03:19 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •