The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 08-21-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
If you just want them datstamped with today's date/time, you can add an -exec parameter to your find command to do this:
Code:
find $CA_OUT_PATH/*/ftp_out -type f -mtime -1 -exec cp -p {} /some/other/directory/{}.`date +%y%m%d.%H%M%S` \;

(Untested, try it someplace safe first)
edit: Ok that didn't work
Instead, pipe the find output for a while-read loop:
Code:
find $CA_OUT_PATH/*/ftp_out -type f -mtime -1 | while read filename ; do cp -p $filename /some/other/directory/${filename}.`date +%y%m%d.%H%M%S` ; done


Last edited by Smiling Dragon; 08-21-2008 at 09:11 PM..