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
Find files with specific time Shahul Shell Programming and Scripting 4 08-20-2008 10:51 AM
How to find a specific files in a many directory selamba_warrior Shell Programming and Scripting 7 05-28-2008 03:41 PM
Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!! anju Shell Programming and Scripting 3 02-01-2008 01:47 AM
find files modified in a specific month omer_ome UNIX for Advanced & Expert Users 1 07-02-2006 09:43 AM
reading files for specific dates siva_jm Shell Programming and Scripting 3 06-08-2004 04:19 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-28-2008
*Jess* *Jess* is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 52
To find files with specific dates and cp another folder.

Hi all,

We have an existing script:
find /u03/oraprod/perpcomn/admin/out -type f -ctime +7 \
-exec cp {} "/u08/oraprod/backup/cout" \;

Which is to find all files more than 7 days and copy to another folder. However I would like to only list files with Sep 29, and cp to another folder.

How can I modify to do so? Thx in advance.
  #2 (permalink)  
Old 10-28-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,262
Code:
find /u03/oraprod/perpcomn/admin/out -type f -ctime +7 -a -mtime -8 -exec cp {} "/u08/oraprod/backup/cout" \;
I am not 100% sure if it hits your needs but you can play around with it with just a -print instead of -exec to see if it is the result you await.

-a for and
-mtime -8 to limit the time allowed

If it won't work no matter what you do, you might want to exec a ls -l and grep the date out of the long directory listing and xarg it into cp for example.
  #3 (permalink)  
Old 03-17-2009
wabard wabard is offline
Registered User
  
 

Join Date: Mar 2009
Location: Adelaide, SA & Perth, WA - Australia
Posts: 25
Exclamation

Please note that the full iso standard file listing is required to successfully execute the following.

Full ISO listing can be accessed via the "ls" command-line option per the following:

U**X: -E
Linux: --full

Please substitute one of the above in the code below under the variable $ISOLISTING

$SOURCEDIR and $DESTDIR should be obvious.

A little messy, but it works.
Code:
(cd $SOURCEDIR ; tar -cf -  `find . -type f -exec ls $ISOLISTING {} \; | grep 2008-09-29 | awk ' { print $9 }'` ) | (cd $DESTDIR ; tar -xpvBf -)
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 03:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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