Search code examples
linuxshelltimecprm

In linux shell, How to cp/rm files by time?


In linux shell, When I run

ls -al -t

that show the time of files.

How to cp/rm files by time? just like copy all the files that created today or yesterday. Thanks a lot.


Solution

  • Simple Example

    find /path/to/folder/ -mtime 1 -exec rm {} \; // Deletes all Files modified yesterday
    

    For more examples google for bash find time or take a look here