+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, Help! A script to find and delete folders and contents in Coding and Web Development; Hi All, Luckily for me I am on a training course all next week which leaves the school with no ...
  1. #1
    reggiep's Avatar
    Join Date
    Apr 2008
    Location
    In the vast area of space and time
    Posts
    1,526
    Thank Post
    506
    Thanked 54 Times in 48 Posts
    Rep Power
    28

    Help! A script to find and delete folders and contents

    Hi All,
    Luckily for me I am on a training course all next week which leaves the school with no tech support as my workmate is off long term sick.
    Unluckily we are running low on server HD space so until my new drives arrive I need an emergency script to help me out.

    What i need is a script that will search through the users on the h: drive to look for folders with certain names
    e.g. "microsoft user data" which is created when a user logs on to a mac adding 20 meg to their folder, which they can do without once they log off agian for the short term!

    I have looked through the scripts already on here but I can't find one that will search through sub directories to find a particular folder and then delete it.

    Could somebody please help?

    Thanks

  2. #2
    Bezwick's Avatar
    Join Date
    Feb 2008
    Location
    Nottinghamshire
    Posts
    346
    Thank Post
    84
    Thanked 53 Times in 40 Posts
    Rep Power
    24
    could try a simple batch file that has something like

    del filename.txt /s /f

    in it

    Quote Originally Posted by reggiep View Post
    Hi All,
    Luckily for me I am on a training course all next week which leaves the school with no tech support as my workmate is off long term sick.
    Unluckily we are running low on server HD space so until my new drives arrive I need an emergency script to help me out.

    What i need is a script that will search through the users on the h: drive to look for folders with certain names
    e.g. "microsoft user data" which is created when a user logs on to a mac adding 20 meg to their folder, which they can do without once they log off agian for the short term!

    I have looked through the scripts already on here but I can't find one that will search through sub directories to find a particular folder and then delete it.

    Could somebody please help?

    Thanks

  3. #3
    reggiep's Avatar
    Join Date
    Apr 2008
    Location
    In the vast area of space and time
    Posts
    1,526
    Thank Post
    506
    Thanked 54 Times in 48 Posts
    Rep Power
    28
    I need to delete folders!
    It needs to search and find those folders and then delete them.

    I don't think that script would do that?

  4. #4

    Join Date
    Feb 2006
    Location
    Derbyshire
    Posts
    1,381
    Thank Post
    181
    Thanked 211 Times in 171 Posts
    Rep Power
    64
    If you know the folder is always in the same place it's relatively simple to walk through the tree structure removing only that folder - I use it to keep our roaming profiles tidy by removing folders created when students play a game etc.

    For /D %%I in (*) DO RD /S /Q "%%I\Microsoft User Data"

    when run in a .bat from the top level of the share/folder structure. I'd normally run it on the server rather than a share just in case anything misbehaves, and as with any automated delete, test it on a dummy folder structure first. It doesn't need to search as any homedirs not containing the MUD folder it will simply continue the loop.

  5. #5
    reggiep's Avatar
    Join Date
    Apr 2008
    Location
    In the vast area of space and time
    Posts
    1,526
    Thank Post
    506
    Thanked 54 Times in 48 Posts
    Rep Power
    28
    Quote Originally Posted by OutToLunch View Post

    For /D %%I in (*) DO RD /S /Q "%%I\Microsoft User Data"
    Not quite right yet for me, probably me doing something wrong.

    I need the batch file to go through the h: drive and then find the folder "microsoft user data"...

    H:\Students\Work\User 13\13Auser\documents
    H:\Staff\Work\Ateacher\documents

    And then delete it!

    It could be in a different area on different users drives.

    I am trying to use edusweeo at the moment to automate this but i don't think it deletes folders?

    Thanks for th help so far!

SHARE:
+ Post New Thread

Similar Threads

  1. find and delete empty folders
    By RabbieBurns in forum Scripts
    Replies: 3
    Last Post: 9th February 2009, 10:16 AM
  2. Replies: 6
    Last Post: 26th September 2008, 03:57 PM
  3. Script to delete specific folders
    By Baasha_Bhai in forum Scripts
    Replies: 8
    Last Post: 2nd July 2008, 10:41 AM
  4. VB script to delete certain folders
    By PTD in forum Scripts
    Replies: 7
    Last Post: 4th June 2008, 12:30 PM
  5. Script to delete certain folders
    By Pumaedition in forum Scripts
    Replies: 4
    Last Post: 22nd April 2008, 10:08 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
  •