copying files according to modification date and extension
Hi,
I am trying to find a command which will copy all the files in the folder with extension ".log" which is created one day before the current date. By going through other threads in this forum I found the half solution to this problem :) find /mnt/hd -mtime -1 -exec scp {} /mnt/usb \; This command copying the all the files created one day before(not only *.log) to the /mnt/usb folder. please let me know what is the modification required to above command. Thanks you!! |
Hi,
Have a look at the man page for find: Code:
man find Kind regards, Eric |
Quote:
Thanks for the Advice. I am able to figure out answer to my question from the man page. But getting some error message with this command #find /mnt/hd/ -mtime -1 -name "*.log" -exec scp {} /mnt/usb/ \; find: scp: No such file or directory find: scp: No such file or directory find: scp: No such file or directory But the command works fine without scp. Not able to figure out what is going wrong here!!! # find /mnt/hd/ -mtime -1 -name "*.log" /mnt/hd/dbg_34.log /mnt/hd/dbg_12.log /mnt/hd/dbg_14.log Thanks |
Hi,
Why are you using scp (secure copy which is part of ssh) to make a local copy to a USB stick? The error you get is because your system cannot find scp. Try with cp instead like this: Code:
find /mnt/hd/ -mtime -1 -name "*.log" -exec cp {} /mnt/usb/ \; Eric |
Quote:
Regards, Srini |
Hi Srini,
Glad you got your solution. Enjoy Linux. Kind regards, Eric |
All times are GMT -5. The time now is 10:27 AM. |