bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7008: On "touch" command


From: Eric Blake
Subject: bug#7008: On "touch" command
Date: Fri, 10 Sep 2010 08:47:38 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

On 09/10/2010 03:30 AM, Dibyajyoti Ghosh wrote:
Hi,
     I needed to change the timestamp of a directory structure of very high
depth. and in each level there are lots of files and folders.
So I expected a recursive operation of "touch" (like -R in chmod or in chown
etc.).

Thanks for the report. However, we are reluctant to bloat any more tools with recursive traversal than absolutely necessary - the whole Unix philosophy is that each tool should do one thing well, rather than making every tool copy common actions from other tools.


     But surprisingly discovered, that "touch" command has no such option
available. So I had to go for a script like..
"find . | touch -am *".

Yes, that is a decent work-around, although it is not quite robust - it can run into command line length limitations, and it mistreats spaces in file names. For a truly robust solution, use:

find . -exec touch -am {} +

Besides, we are reluctant to add new features when existing POSIX features can already be used to the same effect - as you just proved, using find works today on any platform that supports POSIX, whereas if you were to rely on your proposed 'touch -R', you would first have to check if it has been installed on your machine.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]