Under a Linux shell, how can I change the creation time of all a folder's files to the current time?

link|improve this question
1  
The files don't have a 'create time' but they do have a 'modification time'. To change the modification time of a file you use the touch command, e.g. $ touch file1 file2 file3 – boehj Jun 19 '11 at 0:46
Were these answers helpful to you @tomy? – boehj Jun 27 '11 at 6:45
feedback

2 Answers

Navigate to the folder in question, let's say, ~/Documents/myfiles.

$ cd ~/Documents/myfiles

Then do:

$ touch *

This will change the modification time to whenever you executed that command.

Obviously you can make this more specific depending on your use case, e.g.

$ touch *.doc

will only alter the modification time for files with the string '.doc' in their name.

link|improve this answer
feedback

In Linux, if you want to do some thing recursively in directory, or you want to apply some actions on files meeting some criterions,you should try find and xargs

Touch all files in ~/Documents/myfiles (including files in sub directory)

find ~/Documents/myfiles -type f -print0 | xargs -0 touch
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.