+ 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
    992
    Thank Post
    348
    Thanked 93 Times in 62 Posts
    Rep Power
    34

    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
    16,376
    Thank Post
    906
    Thanked 1,811 Times in 1,559 Posts
    Blog Entries
    12
    Rep Power
    468
    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,824
    Thank Post
    372
    Thanked 544 Times in 507 Posts
    Rep Power
    184
    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
    992
    Thank Post
    348
    Thanked 93 Times in 62 Posts
    Rep Power
    34
    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
    992
    Thank Post
    348
    Thanked 93 Times in 62 Posts
    Rep Power
    34
    Thanks FN-GM. That worked perfectly!



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 5
    Last Post: 1st July 2014, 09:34 AM
  2. Empty files and folders on a shared area
    By ranj in forum Windows
    Replies: 6
    Last Post: 6th January 2009, 01:11 PM
  3. Mass Copy of Files and Folders
    By originofsymmetry in forum Scripts
    Replies: 6
    Last Post: 2nd October 2007, 01:16 PM
  4. Restrict "Search files and folders"
    By sandfie in forum Windows
    Replies: 4
    Last Post: 26th March 2007, 11:45 PM
  5. Replies: 4
    Last Post: 15th November 2006, 04: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
  •