Hi,
I have a small task which I was considering using ruby for - if anyone
has a
minute and could quickly type in the ruby code (assuming its a few
lines)
that would be fantastic. The spec is:
Input
- Small ruby program needs to be triggered by a windows batch file (
i.e. called out from within a windows batch file) - The batch file will be provided (from the program that kicks it
off)
with a variable containing a filename
Processing
- Take the filename as input
- To search for files under a given directory (so in including
sub-directories) and delete any files which match the conditions:- (size < 7kb) AND (size > 5kb)
- file is closed (i.e. don’t want to pick up a file currently
being written to by the program which may be just starting to
grow) - Optionally (not sure yet) - May want to limit the files to
those which match a wildcard version of the filename which was
provided by the batch file (e.g. if filename was "
thisfile-v22.mpg", may want to filter on only files matching "
thisfile*" if that makes sense.
Output
- No real output required, however if it was simple a log file which
was appended to with Date/Time, FileDeleted may be nice
Thanks in advance
Greg