matthewst Posted May 9, 2006 Share Posted May 9, 2006 I need to delete a few hundred folders and files in a certain directory. The problem is I also need to keep a few of them. I have been trying to use DirRemove but I'm not sure how to make it remove all but the ones I need to keep. Simply put: I will run the script it will go the defined directory it will delete all files and folders except the ones i told it to leave alone earlier in the script any advice would be greatly appreciated Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 9, 2006 Moderators Share Posted May 9, 2006 I need to delete a few hundred folders and files in a certain directory. The problem is I also need to keep a few of them. I have been trying to use DirRemove but I'm not sure how to make it remove all but the ones I need to keep. Simply put:I will run the scriptit will go the defined directoryit will delete all files and folders except the ones i told it to leave alone earlier in the scriptany advice would be greatly appreciatedI would imagine that you have to use the Beta FileFindFirstFile/NextFile and check those against what you've stored as do not delete. And delete the others if they don't match.I guess you could also do a search in each director for specific files, and do a FileMove to a Temp Directory, and then just delete the Directory, then FileMove again (This might be quicker). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted May 9, 2006 Share Posted May 9, 2006 I would imagine that you have to use the Beta FileFindFirstFile/NextFile and check those against what you've stored as do not delete. And delete the others if they don't match.I guess you could also do a search in each director for specific files, and do a FileMove to a Temp Directory, and then just delete the Directory, then FileMove again (This might be quicker).i want to say that at the end of last summer, someone wanted to do the same thing for some school computers, where each user was allowed a "keep me" folder to be ignored and everything else was wiped out. i'll look it up and see if i can't find the code they used.... Link to comment Share on other sites More sharing options...
matthewst Posted May 10, 2006 Author Share Posted May 10, 2006 i want to say that at the end of last summer, someone wanted to do the same thing for some school computers, where each user was allowed a "keep me" folder to be ignored and everything else was wiped out. i'll look it up and see if i can't find the code they used.... Link to comment Share on other sites More sharing options...
seandisanti Posted May 10, 2006 Share Posted May 10, 2006 sorry, i got wrapped at work yesterday afternoon, but i found it today Link to comment Share on other sites More sharing options...
matthewst Posted May 10, 2006 Author Share Posted May 10, 2006 thanks processing..... Link to comment Share on other sites More sharing options...
seandisanti Posted May 10, 2006 Share Posted May 10, 2006 thanksprocessing.....no problem, glad to help Link to comment Share on other sites More sharing options...
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