I
I
Ivanko2019-03-25 17:00:53
linux
Ivanko, 2019-03-25 17:00:53

How to delete files in subfolders older than a certain date in bash?

How to delete files in subfolders older than a certain date in bash?
Structure:
FolderRoot / Folders* / Files*.jpg
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nekipelov, 2019-03-25
@nekipelov

find /FolderRoot -type f  -name 'Files*.jpg' -mtime +1 -delete

Here the key parameter is mtime:
-mtime n
     The primary shall evaluate as true if the file modification time subtracted
     from the initialization time, divided by 86400 (with any remainder discarded), is n.

D
Dmitry, 2019-03-25
@Tabletko

man find

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question