Login | |
|
 |
RE: Archiving files - 10/9/2006 8:56:42 PM
|
|
 |
|
| |
Snipah
Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
quote:
fso.CreateFolder the above line must be set before the For-loop or else it errors saying it already exists...with that said...if in the root folder 98 files exists the archiving is done over all of those 98, not just 95, so setting up a delimeter is also a must, to retain the 95-files limit I like the way you log in the EventVwr, but that is local-loggin...wouldn't you prefer more a server-side logging (eg. txt file on the server) to monitor events remotely?
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: Archiving files - 10/9/2006 10:41:46 PM
|
|
 |
|
| |
Snipah
Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
quote:
currently an event is raised when the number of files in the folder goes above the 95-files limit [...] do you know any way that this script could run as soon as the event is raised you'll need to know the event is raised, where to read it from (we use NetIQ for DRA, so personally no experience with the monitoring) To create the folder when the files exceed 95 can be done with an If statement and FolderExists..does it also occur that the files exceed their limit multiple times a day? Add a delimiter (one of the so many ways): i=0 For Each File In Files [...] If datediff("d",File.DateLastModified,Now) > 1 And FileCount > 95 AND i < 96 Then 'Move files File.Move """" & path & "\" & archpath & "\" & File.Name & """" End If [...] i=i+1 Next
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: Archiving files - 10/10/2006 12:41:08 AM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1183
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Well, it is possible that one of the files is locked by being open/in use. Just checking the modified time won't guarantee that it isn't opened. Also, it might help a bit if the entire script were pasted. For example, it would help explain was gets passed into the path, archpath, and filetype arguments. Do you want to move the files if there are exactly 95 files or only if there are 96 or more files?
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers) "It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
|
|
| |
|
|
|
 |
RE: Archiving files - 10/10/2006 1:46:17 AM
|
|
 |
|
| |
gdewrance
Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
|
I was trying to run your script and had the same errors Snipah suggested removing the """" from fso.CreateFolder path & "\" & archpath and it worked. The other problem you will have is you will need to see if the folder exsists if not create a new folder + 1 each time else once again the script will fail as the folder already exsists.
|
|
| |
|
|
|
|
|