How to Automate a job to move the latest file with a sequential file name
Solution 1:
There's two parts in your question, so I'll adress them separately. I also don't know how confortable your are with Linux, so please tell me if these guidelines are too blurry.
-
find the latest modified file CEN_06 and copy the file to a different directory : you should be able to do that using the output of
ls -lt
, and then grabbing the first result. After some search, the following seems to be working :ls -t | head -n1
(edit: thanks to @FedonKadifeli for this command). To copy a file, thecp
command is what you are looking for. -
I want to automate a job : one way to automate stuff in Linux is to use crontabs. You should be able to do what you want using them. I recommand you read the man on that subject
man 5 crontab
. You basically put in a.sh
file the commands you want to run, and then crontab will automate it for you at given intervals.