copy all the files in the directory based on the modification date
Quote:
I am trying to copy all the files in the directory based on the modification date (i.e created on Dec 29). Not able to find the proper command for this. This is what I have tried. ' (none) login: root # # cd /mnt/hd/ # # ls *.log dbg_0.log dbg_13.log dbg_18.log dbg_22.log dbg_27.log dbg_6.log dbg_1.log dbg_14.log dbg_19.log dbg_23.log dbg_28.log dbg_7.log dbg_10.log dbg_15.log dbg_2.log dbg_24.log dbg_3.log dbg_8.log dbg_11.log dbg_16.log dbg_20.log dbg_25.log dbg_4.log dbg_9.log dbg_12.log dbg_17.log dbg_21.log dbg_26.log dbg_5.log # ls -l *.log | grep 'Dec 29' -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_20.log -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_21.log -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_22.log -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_23.log -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_24.log -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_25.log -rwxr-xr-x 1 root root 52428800 Dec 29 2010 dbg_26.log -rwxr-xr-x 1 root root 52297728 Dec 29 2010 dbg_27.log -rwxr-xr-x 1 root root 23068672 Dec 29 2010 dbg_28.log # ls -l | grep 'Dec 29' | cp /mnt/usb/ BusyBox v1.11.1 (2010-12-07 11:33:09 IST) multi-call binary Usage: cp [OPTION]... SOURCE DEST Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY Options: -a Same as -dpR -d,-P Preserve links -H,-L Dereference all symlinks (default) -p Preserve file attributes if possible -f Force overwrite -i Prompt before overwrite -R,-r Recurse directories -l,-s Create (sym)links Any hint?? Thanks, SriniKlr |
@SriniKlr - Do not hijack someone else's question!! Please create your own.
|
Quote:
|
My Apologies for the interrupting the already in progress thread. Advice is noted will be taken care :)
Thanks SriniKlr |
Hi SriniKlr
I think you're looking for the find command. Code:
find /mnt/hd -mtime n -exec cp {} /mnt/usb/ \; |
All times are GMT -5. The time now is 05:52 PM. |