I want to download the latest 150 files from S3 Spaces
0
votes
2
answers
1210
views
I want to download the latest 150 files from S3 Spaces. I used this command
s3cmd get s3://obs/site1/uploads/large/ /home/ankit -r | tail -n150
but it does not do what I want; instead, it starts downloading all the files
For example:
If I command:
**INPUT**
s3cmd ls s3://obs/site1/uploads/large/
**OUTPUT**
2020-04-30 20:04 0 s3://obs/site1/uploads/large/
2020-04-30 20:04 1401551 s3://obs/site1/uploads/large/501587671885rwk.jpg
2020-04-30 20:04 268417 s3://obs/site1/uploads/large/501587676002xe2.jpg
2020-04-30 20:04 268417 s3://obs/site1/uploads/large/501587677157ssj.jpg
2020-04-30 20:04 268417 s3://obs/site1/uploads/large/501587747245hea.jpg
2020-05-01 05:23 399636 s3://obs/site1/uploads/large/87429599_1412258992269430_5992557431891165184_o.jpg
And I want to download the only the last file (it is latest) that is:
2020-05-01 05:23 399636 s3://obs/site1/uploads/large/87429599_1412258992269430_5992557431891165184_o.jpg
I can list the latest file but cannot download the latest file:
I listed through:
s3cmd ls s3://obs/site1/uploads/large/ | tail -n1
OUTPUT:
2020-05-01 05:23 399636
s3://obs/site1/uploads/large/87429599_1412258992269430_5992557431891165184_o.jpg
**SO, please tell me the command to download this latest file only?**
Asked by Ankit JaiSwal
(101 rep)
May 1, 2020, 06:37 AM
Last activity: Jul 7, 2022, 10:35 PM
Last activity: Jul 7, 2022, 10:35 PM