I have an issue with a korn shell script that I am writing. The script parses through a configuration file which lists a heap of path/directories for some files which need to be FTP'd. Now the script needs to check whether there are any files which have not been processed and are X minutes old.
The problem is the format of the file is written to be passed into java in the configuration script and I cannot change it.
A few examples:
FTP.Thread.1.File.6.FileName=^WMSDATAFILE_[0-9]{4,6}_To_SuppIn_[0-9]{17}\.dat$
FTP.Thread.1.File.6.LocalDirName=data_to/MOVE/SuppIn
FTP.Thread.2.File.3.FileName=^POSDATAFILE_To_PurchOrderIn_[0-9]{17}\.xml$
FTP.Thread.2.File.3.LocalDirName=data_to/PMS/POIn
Now if I have the filename I can touch a file and use the find command to see if its older as below. But find cannot understand the file format. I was thinking about string replacing certain parts of the filename with stars as the timestamp values don't really matter, but it might get hard with the [0-9] values as they are not necessarily 0-9 for example.
touch -t [datetime X mins ago] touchfile
find [filename without the crap inside] ! - newer touchfile
Any ideas?
P.S. My script already gets the filename and path from the config file. So that part is already done.
P.S.S. Unfortunately I cannot use the -regex in my find..... as the below statement would have worked:
find ./ -regextype posix-extended -regex './XXX_[0-9]{4,6}_XXX.dat' -print