BKGarry Posted July 1, 2015 Posted July 1, 2015 Hello All, I have just moved all over our student and staff files from our old server to our new one with robocopy, but I it has now set all hidden files as visible. I am now getting lots of requests about students work not working but when I go to them it seems that a lot of them have files that start with a ~$ and then the correct file. I assuming this is to do with autorecovery or something as they all seem to be office documents. Is there an easy way of having a script which deletes all files starting with ~$ in a directory and all of its sub directories while leaving all the other files in place? Kind Regards
X-13 Posted July 1, 2015 Posted July 1, 2015 (edited) Wouldn't something simple like this work? FOR %%A in (\\server\share) DO (IF %%A == ~$*.* DEL %%A) Possibly... Obviously you should test it out with a sacrificial folder before hand. Edited July 1, 2015 by X-13 Needs recursion
BKGarry Posted July 1, 2015 Author Posted July 1, 2015 But would that search all the subfolders of that share to delete them? I am sure it is something simple, it is just my brain it totally fried. Too many days of data transfers.
X-13 Posted July 1, 2015 Posted July 1, 2015 But would that search all the subfolders of that share to delete them? I am sure it is something simple, it is just my brain it totally fried. Too many days of data transfers. I revised if for a FOR loop. May need to be FOR /R. However, I am far too hot at the moment to work it out...
BKGarry Posted July 1, 2015 Author Posted July 1, 2015 I know how you feel, I have actually started to work directly on the servers instead of using RDP so that I have an excuse to cool down :-)
sted Posted July 1, 2015 Posted July 1, 2015 couldnt you just search for file names starting ~$ in explorer wait for it to finish then just select all delete?
Gibson335 Posted July 1, 2015 Posted July 1, 2015 ??? del /s /q ~$*.* That looks like it. I used to have a batch file that did this job, scheduled to run overnight.
BKGarry Posted July 1, 2015 Author Posted July 1, 2015 Than you all, the simple del command did it, I was just being simple and slow :-)
BKGarry Posted July 1, 2015 Author Posted July 1, 2015 Just to let you know, this has solved the problem :-) it was exactly what I needed. I have been out for a Pizza now and some shopping (brought a copy of The Way Things Work - New Edition :-) ) and seem to be back on game. I purely was not thinking earlier
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