reggiep Posted March 20, 2009 Posted March 20, 2009 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
Bezwick Posted March 20, 2009 Posted March 20, 2009 could try a simple batch file that has something like del filename.txt /s /f in it 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
reggiep Posted March 20, 2009 Author Posted March 20, 2009 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?
OutToLunch Posted March 20, 2009 Posted March 20, 2009 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.
reggiep Posted March 20, 2009 Author Posted March 20, 2009 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!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now