![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Microsoft windows 2003 error all error and bugs related to microsoft windows 2003 error |
![]() |
|
Automatically deleting files based on filename, age
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Fixed Error!
Posts: 4,202
Join Date: Mar 2007
Rep Power: 6
IM:
|
The unneeded files are easily identifiable by file path, and in VERY RARE instances they might be useful for a day or two. I'd like to schedule an agent to run every night to go through and delete any of these files that exist on the server that are more than 48 hours old. But I don't know what the commands necessary to do this are. Let's say the files in question have an extension of .dbg and alway appear in a directory called Debug, but that there can be a Debug directory in any other directory on the server, so I need to find the files and delete them anywhere in a root directory. If someone can provide the code for the batch file, I can schedule the bugger, but I'm stumped on the batch code. This should be pretty easy to anyone who knows what they're doing. Unfortunately, this excludes me. |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Fixed Error!
Posts: 4,202
Join Date: Mar 2007
Rep Power: 6
IM:
|
Simply alter this section/line: Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='C:\'} Where " _ & "ResultClass = CIM_DataFile") to read: Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='D:\Application Data\Repository\Data\Default\'} Where " _ & "ResultClass = CIM_DataFile") |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|