bash:find_files_with_modified_dates_in_the_future_and_fix
Differences
This shows you the differences between two versions of the page.
bash:find_files_with_modified_dates_in_the_future_and_fix [2019/05/13 16:26] – created genadmin | bash:find_files_with_modified_dates_in_the_future_and_fix [2019/05/17 09:45] (current) – genadmin | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Sometimes, when working on a new machine or a machine with a screwy clock or incorrect TZ you can then have files modified in the future which breaks some things. | ||
+ | To find the files modified in the future use | ||
+ | |||
+ | < | ||
+ | |||
+ | Now to fix the files to NOW use | ||
+ | |||
+ | < | ||
+ | |||
+ | You can use -d with touch to specify the date you want to use instead of now. | ||
+ | |||
+ | How about finding all files that have not been modified for more than 20 years? | ||
+ | |||
+ | < | ||
+ | |||
+ | The +7300 is 20*365 or 20 years. If you wanted to delete these files then -delete will do it. If you wanted to archive these files then output the filenames to a file with > filename.txt and then either sed that into cp commands or feed it into the cp. |