Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Some of the files we receive on our Redhat server are showing date different from upload date as the last modification time. For us the modification time is important as we classify files depending on date we receive it. Some of these file show earlier timestamps, maybe that of files original creation/modification date on client machine.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

*nix filesystems provide 3 distinct timestamps:

  • mtime is the time the file's contents was last modified
  • ctime is the time the file's attributes were last changed
  • atime is the time the file was last accessed

The timestamp usually shown in directory listings is the mtime, because it is the most useful; however, many FTP servers will upload a file to a temporary filename and then rename the file once complete, to avoid exposing incomplete files to the OS.

This causes the mtime and ctime to differ for newly-created (uploaded) files; the ctime will show the time the file finished uploading and was renamed, while the mtime will show file creation time.

If you can show some samples of what you're talking about, perhaps additional help can be offered.

share|improve this answer
    
Thanks for your explanation. I was able to list all the files that came yesterday using -ctime -1 flag for find which I wasn't with with -mtime flag. So ctime will always show the upload time-stamp, right? –  nitins Jan 15 '13 at 11:21

When I want to change the file modification time, I use an FTP client on the console. Log on with ftp ftp.example.com, then

  • cd commands go to the correct directory
  • SITE command to move the extended command mode
  • UTIME somefile.txt 20050101123000 20050101123000 20050101123000 UTC

Change the access time, modification time, it's time to create a directory on 2005-01-01 12:30:00 somefile.txt. Complete example:

site UTIME somefile.txt 20150331122000 20150331122000 20150331122000 UTC
share|improve this answer
    
Of course you can use this command in any ftp client. –  adam111p Apr 6 at 8:58
    
This does not answer the question: you can manually modify dates with this, but it doesn't help with the problem where file loses information on real modification dates during upload. –  Esa Jokinen Apr 6 at 10:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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