July 12, 2023

Copy, move or delete recently modified or downloaded files

To copy all the pdf files downloaded in the last day to a directory files run:

$ find /home/user/Downloads/*pdf -maxdepth 1 -mtime -1 -print -exec cp -t /home/user/Desktop/files {} +

To move all files, replace cp by mv.

To delete all files modified in the last day in the directory named Downloads:

$ find /home/user/Downloads/* -maxdepth 1 -mtime -1 -print -delete 

Run $ man find<> to learn to adjust each of the options used above.

The programme find was published in 1971 and is copyleft-licensed.


personal computing command-line interface (cli) gnu linux trisquel office applications find wiki shell literacy

No affiliate links, no analytics, no tracking, no cookies. © 2016-2023 yctct.com. Content is licensed under CC BY-NC-SA 4.0 .