Reputation: 551
So I want to be able to go into a folder and update "last modified" data on every file within.
So far, I think I should be using:
touch --date "2012-12-31" /tmp/date
find /filestotouch -type f -not -newer /tmp/date
And this should list all the files that match. Now, do I need to make a loop, or is there a simple way to pass this data to touch and have it do them all?
Upvotes: 0
Views: 1780
Reputation: 328604
There are two options:
-exec
: ... -not -newer /tmp/date -exec touch "{}" \;
xargs
: ... -not -newer /tmp/date -print0 | xargs -0 touch
Upvotes: 3
Reputation:
Try the find command:
find /filestotouch -iname "*.type" -mtime +60 -exec touch "{}" \;
The above commands will extract all the files that were modified 60 days back.
Upvotes: 1