[NBLUG/talk] GNU touch, and the file creation date

Kyle Rankin kyle at nblug.org
Thu Feb 28 21:27:02 PST 2008


On Thu, Feb 28, 2008 at 09:20:10PM -0800, Rick wrote:
> Hi everyone,
> 
> The GNU touch command can be used to set the file modification and/or access dates to any arbitrary datetime value.  For some reason, it does not allow the file creation date to be changed.
> 
> >touch --time=modify -t 200112310000 filename
> >touch --time=access -t 200212310000 filename
>  
> Does anyone know of a way to change a file's creation date?

Do you mean the "Changed" time section of MAC times, instead of "Creation"
date? If so, that changes when the metadata (file ownership, permissions,
etc.) changes.

> 
> Aside :  when viewing the file access date, by using the ls command, it appears that the file access date is reset to the current datetime after the results are displayed.  Is there any way to view the file access date without changing it?
> 
> >ls -l --time=access filename
> 
> Thanks,
> Rick
> 
>        

The only way to view the access time without then modifying the access time
is to do so from a read-only file system. By the way, you will also modify
the access time of the file's directory when you access it.

-- 
Kyle Rankin
NBLUG President
The North Bay Linux Users Group
http://nblug.org
IRC: greenfly at irc.freenode.net #nblug 
kyle at nblug.org



More information about the talk mailing list