[Top][All Lists]

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

Re: touch: enhancement request to preserve file ownership and permission

From: Bob Proulx
Subject: Re: touch: enhancement request to preserve file ownership and permissions
Date: Wed, 12 Sep 2007 22:38:54 -0600
User-agent: Mutt/1.5.9i

Eric Blake wrote:
> How is this different from the current two-step process
> 'chmod --ref=reffile yourfile && touch --ref=reffile yourfile'?

Depending on the case where touch is used to create an empty file I
think the order of those should be reversed.

  touch --ref=reffile yourfile && chmod --ref=reffile yourfile

This works because changing the mode bits only changes the ctime and
not the atime or mtime.  Touch -r also only sets atime and mtime and
and of course ctime is updated to the current time.

Of course if no files are being created because they already exist
then the order does not matter.

Updating the mtime and file mode to match a reference file but not
updating the contents of the file seems like a very unusual situation
to me.  Normally the contents would be updated too.  In which case
rsync is a good tool to use.

  rsync -a reffile yourfile


reply via email to

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