Batch help

Closed
prolan - Dec 10, 2008 at 10:22 AM
Swarve
Posts
4
Registration date
Monday December 8, 2008
Status
Member
Last seen
December 10, 2008
- Dec 10, 2008 at 05:01 PM
Hello,

I am hoping to get some assistance with the following tasks:

The batch script should:
Search for "deleted.log" within a specified CIFs share parsing directories and nested folders. I have a path that could be used as a variable however, there are thousands of directories that have the file located in the same logical location within the folder structure.

\\server\share\%randomfolder%\delete_files\deleted.log

I want to copy "deleted.log" file for every location within the folder structure from each share to a corresponding archive folder located at a different target location. This is to back it up.

During that copy process, I need to alter the name of each file by appending YYYY-MM-DD-deleted.log

I Never overwrites other log files (it shouldn't happen that the same date is written twice, but this should be programmatically checked)

Then create another script with the following properties:
a) Parses most recent deleted.log files for all sites by reading latest log archived by script 1
b) Looks for two strings: "Restored from deleted_files folder" and "Could not find cache file"
c) If the strings are found, generates an SMTP alert with the complete folder and path location of the associated deleted.log file


I am a noob. In over my head a bit and need some help from the brilliant follks on this site. Thanks in advance!

1 reply

Swarve
Posts
4
Registration date
Monday December 8, 2008
Status
Member
Last seen
December 10, 2008
4
Dec 10, 2008 at 05:01 PM
Hi Prolan,

Does the script need to be fully in a batch file? I believe something like this would be more suited to a vbscript file.

To start with, the DOS command : dir /s /b deleted.log >loglist.txt
will generate a complete list of all of the deleted.log files complete with folder structure.

Parsing the contents and generating the alert email would be better done utilising vbs.

Cheers,

Swarve
0