We have a program that generates text files as output as a way to communicate with other systems.
I need to manage this directory in a very careful way and Im having a little trouble figuring out how to do what I need to do.
HERE GOES
The directory in question is a central repository of text files with unique names to ease the file storage archival purposes.
Every 30 minutes a new file named I*******.RP (where ******* is a 7 digit number in an attempt to keep files unique over a reasonably extended period of time (like six months))
There are other files in the same directory with similar names like Q*******.SP, etc.
The format of each name is designed so that we know what type of data is in each file.
We want to manage the data by type, and by age.
I need to be able to manage all files of a certain type with one set of rules, and all files of another type with another set of rules.
for example find all files of type I*******.RP and get rid of any of them older than X days
find all files of type Q*******.SP and get rid of any of them older than Y days
I also need to be able to find the newest file of each type and rename it to a known file name so that it can be used in scripts that drive the transfer of data to other servers.
eg: find the newest I*******.RP file and rename it to inventory.txt
Im not new to linux scripting, but Im new to some of the find/search tools and how to apply them to this subject.
Thanks all.
Start Free Trial