Reputation: 1
I have a couple of files in a folder such as abc_2-01-2019.csv
, abc_2-02-2019.csv
, abc_2-03-2019.csv
, abc_2-04-2019.csv
, and I want to pick the latest file and send it over an email as an attachment on Linux VM. Can anybody help me out?
Upvotes: 0
Views: 31
Reputation: 30565
ls -Art | tail -n 1
where
-A do not include . and ..
-t sort by modification time
-r reverse sort
and tail -n 1
gets last entry
Upvotes: 1