akelabanda
Programmer
Hi Guys
Hope you can help me with this.
I have to deal with a set of file that come in everyday.
Example
x1
x2
x3.gz
x4.gz
x5.gz
x6.gz
x7.gz
x8
x9
x10
In the example above, I have to pick the oldest file from the list and process it (x1, x2, x3, etc). However, to save on space, there is a job running in the background that gzips these files (x3 - x7).
Also, there are new files that come in (x8 - x10).
At present, the job that processes these files picks all unzipped files. So, the problem is, it's going to pick x8 after finishing x1, x2 which is wrong.
I would like to run a ls -1tr | head -1 which gives me the oldest file in the list. If it's gzipped, want to unzip it and let the program pick the correct sequence.
Any ideas / code bits that can be helpful will be great.
Oooh.. That's a long question, just realised.
Thanks guys.
Raj
UK's best mobile deals online
Hope you can help me with this.
I have to deal with a set of file that come in everyday.
Example
x1
x2
x3.gz
x4.gz
x5.gz
x6.gz
x7.gz
x8
x9
x10
In the example above, I have to pick the oldest file from the list and process it (x1, x2, x3, etc). However, to save on space, there is a job running in the background that gzips these files (x3 - x7).
Also, there are new files that come in (x8 - x10).
At present, the job that processes these files picks all unzipped files. So, the problem is, it's going to pick x8 after finishing x1, x2 which is wrong.
I would like to run a ls -1tr | head -1 which gives me the oldest file in the list. If it's gzipped, want to unzip it and let the program pick the correct sequence.
Any ideas / code bits that can be helpful will be great.
Oooh.. That's a long question, just realised.
Thanks guys.
Raj
UK's best mobile deals online