Previously I have ran dos2unix
on every *.php
file on my server recursively with this command:
find . -name '*.php' -type f -exec dos2unix --keepdate {} +
All files processed by dos2unix
had its last modified datetime intact, but the parent directory containing such files still have their last modified datetime updated to the time I ran the command.
How do I, with an one liner, touch the directories recursively, setting the last modified datetime of the directories as the same datetime as the last modified file inside the directory?
From this:
dir_a/ 2013-05-13 14:05
abc.php 2012-09-01 12:34
def.php 2012-09-15 23:45
dir_b/ 2013-05-13 14:05
uvw.php 2012-10-01 01:23
xyz.php 2012-10-08 09:10
To this:
dir_a/ 2012-09-15 23:45
abc.php 2012-09-01 12:34
def.php 2012-09-15 23:45
dir_b/ 2012-10-08 09:10
uvw.php 2012-10-01 01:23
xyz.php 2012-10-08 09:10
The server is running on CentOS 5.6.