LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-04-2005, 09:34 PM   #1
taiwf
Member
 
Registered: Jun 2005
Distribution: debian, ubuntu, redhat,knoppix
Posts: 194

Rep: Reputation: 31
-exec {} won't do copy completely??? Help


I try to copy file using

find /mirror/home/dfeng -mmin -1440 -o -cmin -1440 -exec cp -v --target-directory=/usr/local/bin/mytemp --parents {} \;

where i only want to copy file that's change in past 24 hours. But somehow i always miss files after some copy process is occured. My find portion command give me correct selection of files. But when it come to copy (after -exec) , no error message and many files not copy. Can anyone help me with this??



------ files return from find /mirror/home/dfeng -mmin -1440 -o -cmin -1440 ------

/mirror/home/dfeng/Maildir
/mirror/home/dfeng/Maildir/cur
/mirror/home/dfeng/Maildir/cur/1128333610.V801I27c35a.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128333610.V801I27c35c.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128334467.V801I27c35d.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128344270.V801I27c35e.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128347467.V801I27c35f.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128352096.V801I27c360.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128382735.V801I27c35b.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128388805.V801I27c361.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128389982.V801I27c363.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128392292.V801I27c362.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128398096.V801I27c364.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/cur/1128399776.V801I27c366.fdaserver.fdrive.com.au:2,S
/mirror/home/dfeng/Maildir/new
/mirror/home/dfeng/Maildir/new/1128420103.V801I27c365.fdaserver.fdrive.com.au
/mirror/home/dfeng/Maildir/new/1128420103.V801I27c368.fdaserver.fdrive.com.au
/mirror/home/dfeng/Maildir/new/1128426356.V801I27c369.fdaserver.fdrive.com.au
/mirror/home/dfeng/Maildir/new/1128433867.V801I27c36a.fdaserver.fdrive.com.au
/mirror/home/dfeng/Maildir/tmp
/mirror/home/dfeng/Maildir/tmp/testfile
/mirror/home/dfeng/Maildir/Outlook.pst
/mirror/home/dfeng/Maildir/courierpop3dsizelist
------------actual files got copy---------------
`/mirror/home/dfeng/Maildir/cur/1128333610.V801I27c35a.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128333610.V801I27c35a.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128333610.V801I27c35c.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128333610.V801I27c35c.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128334467.V801I27c35d.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128334467.V801I27c35d.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128344270.V801I27c35e.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128344270.V801I27c35e.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128347467.V801I27c35f.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128347467.V801I27c35f.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128352096.V801I27c360.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128352096.V801I27c360.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128382735.V801I27c35b.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128382735.V801I27c35b.fdaserver.fdrive.com.au:2,S'
`/mirror/home/dfeng/Maildir/cur/1128388805.V801I27c361.fdaserver.fdrive.com.au:2,S' -> `/usr/local/bin/mytemp/mirror/home/dfeng/Maildir/cur/1128388805.V801I27c361.fdaserver.fdrive.com.au:2,S'
---------------------------------------

thx in advance
 
Old 10-04-2005, 09:46 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
I wonder if this will work better...
Code:
find /mirror/home/dfeng -type f \( -mmin -1440 -o -cmin -1440 \) \
-exec cp -v {} /usr/local/bin/mytemp \;
 
Old 10-05-2005, 01:23 AM   #3
taiwf
Member
 
Registered: Jun 2005
Distribution: debian, ubuntu, redhat,knoppix
Posts: 194

Original Poster
Rep: Reputation: 31
I follow your script and it work except there is no directory structure preserved. Then i try to put bracket () around my test [ie. -mmin -cmin] and it work!

find /mirror/home/ \( -mmin -1440 -o -cmin -1440 \) -exec cp -v --target-directory=/tmp/mytemp --parents {} \;


Now , can you give me some hint why we need bracket in this case? Do we always has to use bracket when having more then on tests?

Besides, is there a way to use xargs for this problem?

thx
dav

Last edited by taiwf; 10-05-2005 at 01:24 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Completely copy hard drive... markw8500 Linux - Software 3 08-21-2005 05:42 AM
c++ exec fosh Programming 2 07-04-2004 11:44 AM
how to copy and paste acd copy cd paschim Linux - General 2 04-05-2004 10:25 AM
cannot exec as person Linux From Scratch 5 12-19-2003 05:31 AM
boot error after using Copy Commander to copy debian system onto larger new drive Interceptor Linux - Hardware 7 05-04-2003 01:40 PM


All times are GMT -5. The time now is 02:05 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration