Sarch allows you to archive logs, delete files using times and dates in your wildcards, and more. Sarch is basically a command executer with a limited number of variables that can be output as parameters.
Website: https://analogx.com/contents/download/S ... eeware.htm
Download: https://analogx.com/files/sarch.zip
Documentation (copied below): https://analogx.com/contents/download/S ... tation.htm
Sarch is like most command line utilities out there; from the command prompt you can type the name by itself to get a list of options:
Code: Select all
Usage: Sarch [options]
Options: /TARGET [path] Destination for files
/SOURCE [path] Source for files (def: current)
/FILENAME [name] Destination filename
/WILDCARD [match] String to use to find matches (ie; ex12*.log)
/OFFSET [time] Time to offset (ie; 1d=1day, 10h=10hours)
/EXECUTE [...] Command to execute
- TARGET This is the path where you want the files to be copied to. It
supports both relative (..\) paths or literal paths (C:\). I
would recommend using literal whenever possible to eliminate
any possible ambiguity, unless you are comfortable with using
relative paths. - SOURCE This is the directory it is going to be working in. If no
source directory is specified, then it will use the current
mounted path. - FILENAME This specifies the destination filename - this is purely
optional, but can sometimes help to make things a bit more
intuitive when you are using the same filenames for multiple
operations. - WILDCARD This is another optional option (imagine that). As with the
FILENAME, it's purpose is to help clean up multiple use
operations. - OFFSET This is the amount of time to offset the current time by.
Different units may be used (h = hour, d = day, m = month,
y = year), and mixed units may be specified, so 1d5h is a
valid offset. - EXECUTE This is the actual string that will be executed.
echo {HOUR}
which would in turn execute this:
echo 5
See? The {HOUR} is translated into whatever it is set to before it does anything. It's also important to point out that all variables MUST start with a { and end with a }. Also, while they are not case sensitive, they must be punctuated exactly as noted in these docs. Here's the list of variables supported:
- Time.Month Displays the month in numeric form, 1-12
- Time.MonthPad Same as Time.Month, but will always be two digits,
so 03 instead of 3. - Time.Day Displays the day in numeric form, 1-32
- Time.DayPad Same as Time.Day, but will always be two digits,
so 09 instead of 9. - Time.Year2 Displays the year in two digit for (2001 = 01)
- Time.Year4 Displays the year in numeric form
- Config.Filename The processed filename
- Config.Source The processed source directory
- Config.Target The processed target directory
- Config.Wildcard The processed wildcard specification
Code: Select all
sarch /source "C:\Logs\" /target "{Config.Source}archive\{Time.Year4}\" /wildcard "ex{Time.Year2}{Time.MonthPad}??.log" /OFFSET -1m /filename "{Time.MonthPad}{Time.Year4}.zip" /execute "C:\WinZip\wzzip -ex {Config.Target}{Config.Filename} {Config.Source}{Config.Wildcard}"
sarch /source "C:\Logs\" /target "{Config.Source}archive\{Time.Year4}\" /wildcard "ex{Time.Year2}{Time.MonthPad}??.log" /OFFSET -1m /filename "{Time.MonthPad}{Time.Year4}.zip" /execute "del {Config.Source}{Config.Wildcard}"
If you need to enclose something in quotes, such as a path with spaces in it, and use it as a parameter, then you must enclose it in double quotes:
BAD: sarch /execute "C:\WinZip\wzzip -ex C:\Program Files\Whatever.exe"
GOOD: sarch /execute "C:\WinZip\wzzip -ex ""C:\Program Files\Whatever.exe"""
These 'escaped' quotes will be passed through the program.
If for some reason either the source or destination directories do not exist, the program will create them before executing the command. This is to help ensure that the executed command doesn't fail because it doesn't gracefully handle non-existent directories.