![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| does any one know how to solve? | mlhazan | High Level Programming | 14 | 08-27-2008 03:14 PM |
| How to solve this | akashag22 | Shell Programming and Scripting | 3 | 07-21-2007 05:54 AM |
| Can AWK solve it ??? | emon | Shell Programming and Scripting | 1 | 02-23-2005 01:07 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Can somebody solve this
I have to find the files older than 200 days from a path and copy them to some other directory with the current date stamp attached to it.
i have written like follows: #!/bin/ksh DSTAMP=$(date +"%y%m%d%H%M") rm $CA_OUT_PATH/ftp_logs/temp touch $CA_OUT_PATH/ftp_logs/temp chmod 777 $CA_OUT_PATH/ftp_logs/temp find $CA_OUT_PATH/*/ftp_out -type f -mtime -200 > $CA_OUT_PATH/ftp_logs/temp while read line do cp -f $line $CA_OUT_PATH/ftp_logs/${line}.$DSTAMP done < $CA_OUT_PATH/ftp_logs/temp but its trying to copy the entire path of the file and failing. I need to copy the only filenames.datestamp after the search pls look in to this help me out. |
|
||||
|
Code:
find /old_path/* -type f -mtime +200 -exec echo {} /new_path/{}$(date +"%y%m%d%H%M") \;
Please read and respect the Simple rules of the UNIX.COM forums: |
|
||||
|
Hello Jim,
Its the same problem the find query bringing the files with the total directory structure and when trying to copy them with total path as per our logic and code failing to copy entire directory struture for eg see the code and output: CODE: #!/bin/ksh find $CA_OUT_PATH/*/ftp_out -type f -mtime -200 |\ while read file do echo "$file"$(date +"%Y%m%d%H%M") | read newfile cp $file $CA_OUT_PATH/ftp_logs/$newfile done Output: cp: cannot create /d09/out/ofad/ftp_logs//d09/out/ofad/glinf/ftp_out/glinf_xslgliaf.ftp.msg200808291526: No such file or directory |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|