View Single Post
Old 06-13-2009   #7 (permalink)
Pegasus [MVP]


 
 

Re: Clean out old files from multiple subfolders


"Todd Vargo" <tlvargo@xxxxxx> wrote in message
news:uclsIY86JHA.1424@xxxxxx
Quote:

> Pegasus [MVP] wrote:
Quote:

>> Rich wrote:
Quote:

>> > Wow, I think that is like 90% what I'm looking for. Looks like that
>> > script
>> > deletes the files out of all subfolders. I only need to have it delete
>> > files
>> > of MaxAge out of specifically named subfolders, like Folder1 and
>> > Folder2
>> > in
>> > my example. How could I make it do that?
>> >
>> > For instance, under Users, say i have folders named Users000 through
>> > Users100. Then under each Users### folder there are 12 subfolders,
> which
Quote:
Quote:

>> > have subfolders, and buried somewhere in that subfolder mess are two
>> > folders
>> > named Folder1 and Folder2. I only want to delete files of MaxAge
>> > within
>> > Folder1 and Folder2. Deleting them from any other folder would be VERY
>> > bad.
>> >
>>
>> You need to make the file deletion process conditional upon the name of
> the
Quote:

>> current folder. Lines [24]/[33] in the script below will do this. Line
> [08]
Quote:

>> contains a list of folder names that are subject to deletion. Each name
> must
Quote:

>> be delimited on both sides with a vertical bar.
>>
>> [01] '--------------------------------------------
>> [02] 'This script will delete files that were last
>> [03] 'updated "MaxAge" or more days ago.
>> [04] '13.6. FNL
>> [05] '--------------------------------------------
>> [06] Const Active = False
>> [07] Const sSource = "d:\Users"
>> [08] Const sFolderNames = "|folder1|folder2|folderx|" 'Lower case!
>> [09] Const MaxAge = 10 'days
>> [10] Const Recursive = True
>
> And remember to set "Recursive" on line [10] to False.
> (or remove lines 35 thru 38)
>
> --
> Todd Vargo
> (Post questions to group only. Remove "z" to email personal messages)
>
Hhm, well, not quite. Since the OP says that the named folder is buried deep
inside his folder structure then "Recursive" should be set to True.


My System SpecsSystem Spec