Quote:
Originally Posted by moviecarpet
Hi
I wanna copy all folders and files created from 01.01.2011 until today to new place
ie:
cp -r /home/moviecar/public_html/wp-content/uploads/ /home/teaser/public_html/wp-content/uploads
|
The Linux ext filesystem does not store creation time. You probably want modification time. Using -mtime is not the only option. You can use find's -newer and/or -newerXY option to achieve what you are trying. But you will first have to generate a reference file with the same timestamp that you want to use as reference; in your case that would be 01.01.2011. The 'touch' command can do this:
Code:
touch -t 201101010000 reference.file
Confirm that the modification time is correct
Code:
$ stat -c "%y %n" reference.file
2011-01-01 00:00:00.000000000 +0000 reference.file
Now you can use this file as reference file for the -newer option:
Code:
find /path/to/folder -type f -newer reference.file -exec cp '{}' /path/to/target/folder \;
I see a windows logo in your profile. If you want to search a windows partition then you could try to use the -newerXY option (man find for more info on that).
Code:
find /path/to/folder -type f -newerBB reference.file -exec cp '{}' /path/to/target/folder \;
'-newerBB' means that it will compare the birth-time of the file which should be the creation time in windows. Note, that you will also have to create the reference file on a windows partition, so that it will have the creation time attribute.
[IMPORTANT]
I have used this technique on Linux filesystems but I have never tried using 'find' this way on a windows partition. I am simply deducing the procedure.
Hope this helps.