vendredi 30 janvier 2015

How to bump file timestamps by 3 months (for a directory tree)?


I am looking at the touch command line utility, and from the examples I found in tutorials, I see how one can bump the access or modification timestamp to a specified time, the current time, or to a reference file.


However, I would like to do the following: The relative age of my files (relative to each other) has information valuable to me, and I'd rather not lose that. But I need to look each file in (recursive) folders look a few months younger than they are. So each file could refer to itself, bump the time, but apply this to each file in a tree of folders. What is a good way to do this?



#!/bin/bash
FILES=$(find $HIGHEST_FOLDER -type f -name *.*)
for f in $FILES
do
touch -ram f -F 7776000 f
# bumping access and modification timestamps by 3 months?
done


Or am I better off using find -exec as suggested in this answer? (There are many files in these folders.) How could that work?



Aucun commentaire:

Enregistrer un commentaire