Jump to content
Sign in to follow this  
matthewst

Trying To Remove All But Certain Directories

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

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).


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.

Share this post


Link to post
Share on other sites

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....

Share this post


Link to post
Share on other sites

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....

:):(:D

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...