Jump to content

Recommended Posts

Posted (edited)

Hello all,

I want to complete a script but it seems like I have stuck here...

What I want to do, is to store some subfolder names to a variable (or an array) in an .INI file and to DirRemove ALL the contects of the parent folder, except the declared ones.

For example if we have:

$keep[1] = "keep.folder.1"

$keep[2] = "keep.folder.2"

$keep[3] = "keep.folder.3"

And the folder tree is like:

C:\Do.the.job.here\keep.folder.1\

C:\Do.the.job.here\keep.folder.2\

C:\Do.the.job.here\keep.folder.3\

C:\Do.the.job.here\keep.folder.4\

C:\Do.the.job.here\other.folder.1\

C:\Do.the.job.here\other.folder.2\

C:\Do.the.job.here\other.folder.3\

...I want only "keep.folder.4" and "other.folder.*" to be deleted.

Any ideas of how to accomplish this are more than welcome.

Edited by erebus
Posted

You could have it check the path, or name, of the file by using something like _PathSplit, then using an If-Then statement, have it check for those files, and if they are those files, delete them.

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Posted

I don't know what files I want to delete.

I just know what files I want to exempt.

Please do not hurry to answer.

Posted (edited)

Yes, can you help me a bit more?

Give a code example if possible.

Edit: The problem here is how to check within a For/Next loop for my array. Maybe it is going to work for a one-dimensional array. What about a two-dimensional one?

Edited by erebus
Posted

Ok, I finally used a one-dimensional array and _ArraySearch seems to do the job just fine.

Thank you all.

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
×
×
  • Create New...