I have modified some files present in various folders in my ftp server. This was development environment. Now I have to find all files and directories modified or created yesterday to migrate to productions.

Is there any way (Linux command) to list only those files and folders created or modified yesterday in my ftp root tree?

I want the command to return such address:

  • Do you need to do this over FTP, or can you have access to the filesystem directly?
    – ilkkachu
    Jan 6 '18 at 15:57

To find files and directories which have been modified in the last 24 hours:

find path -daystart -mtime -1

The option -mtime uses the modified date. To look at the created date, use -ctime.

  • I think the OP was asking about how to combine -mtime and -ctime together (with an "or" relationship)
    – Tom Auger
    Dec 26 '19 at 19:06
  • 1
    -ctime checks the status change time, not creation time (whatever that is). Dec 26 '19 at 20:12

To find files and directories modified OR created in the last 24 hours:

find . \( -mtime -1 -or -ctime -1 \) -ls

This solution uses the "or" operator to combine mtime and ctime results inclusively. The \( and \) are the brackets, escaped with \ to group the OR components together. I added the -ls option to then list out those files so you could see the timestamp information

  • 1
    -ctime checks the status change time, not creation time (whatever that is). -Btime (for birth time) is supported on some systems, not GNU/Linux yet. Dec 26 '19 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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