Is there a command to only copy files before a certain date, say 20120901? Furthermore, I would like to do it with cp -p capability (e.g. the original timestamp is preserved).
Linux, only copy files before a certain date
copylinux
Related Topic
- Linux – find only files with certain prefix
- Linux – Using Find to Locate Files Older Than a Specific Date
- How to let ‘cp’ command don’t fire an error when source file does not exist
- Linux – How to copy file preserving directory path in Linux
- Linux – How to Copy Range of Files in Command Line (ZSH/BASH)
- Bash – rsync not working – want to copy only certain subdirectories and files
- Linux – Find command exclude files whose path match a certain pattern
- Windows – How to Copy Timestamps Only of Already Copied Files and Folders
Best Answer
Yes, you should be able to do it with a combination of touch and find.
So what this does is find all files underneath the directory
$PATH
that have been modified before September 1st, 2012 at 00:00:00 hours and copy them all to the directory/new/location