The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
search files and copy them to a directory with datestamp attacched to it sreenusola Shell Programming and Scripting 1 10-03-2008 06:20 AM
Copy files from a directory by ftp hippa77 UNIX for Dummies Questions & Answers 3 10-06-2007 02:26 PM
Copy files from one directory to another HAA Shell Programming and Scripting 1 07-06-2006 02:47 AM
Copy files from one directory to another hd2006 Shell Programming and Scripting 0 06-07-2006 02:29 PM
copy files from one directory to another directory zip_zip UNIX for Dummies Questions & Answers 5 09-14-2003 06:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2008
sreenusola sreenusola is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 19
search files and copy them to a directory with datestamp attached to it

Hi I need to search the some ftp files created in last 24 hours and copy them to a directory with date stamp attached to it.

Iam using following command to search the files
find $CA_OUT_PATH/*/ftp_out -type f -mtime -1

but now how to copy these files to some other directory one by one
with date stamp attached to each file.

Please reply ...its urgent

thanks in advance
  #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: 921
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 08:11 PM..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0