Sign in to follow this  
Followers 0
matthewst

Trying To Remove All But Certain Directories

7 posts in this topic

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


[center]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.[/center]

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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

:):(:D

sorry, i got wrapped at work yesterday afternoon, but i found it today

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

thanks

processing.....

Share this post


Link to post
Share on other sites

thanks

processing.....

no problem, glad to help

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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  
Followers 0