copy a file with a specific date
I have some files which are different timestamp , can advise if I would like to copy a specific date ( eg. May 1 2012) to another directory , what can i do ? thx
|
We need to see examples of the filenames (is date in the filename or do you mean mtime?) and where you want them to go.
What have you written so far? These may help http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ http://linux.die.net/man/1/date |
hi ,
may be I explain more detail , what I would like to do is just copy the files which the date is May 1 2012 to another directory ( eg. /tmp ) . thx |
I assume you mean the date shown in the ls command (this defaults to modification time--I think). The "find" command allows you to filter based on three kinds of time( accessed, changed status, and modified ) but the logic is based on the elapsed time and not an absolute date. (Look at "man find" to see if I've missed something)
The brute force way to do it is to simply use grep to find the date and then pass the filename to the mv command. Something like this maybe (NOT TESTED) Code:
for file in $(ls -l); do there must be an easier way to do this........ |
All times are GMT -5. The time now is 11:42 AM. |