![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| crontab + exec command | naushad | Shell Programming and Scripting | 4 | 03-27-2008 12:23 AM |
| Help with exec command and file descriptors?? | rfourn | Shell Programming and Scripting | 1 | 07-18-2007 03:05 PM |
| find command exec error | pavan_test | UNIX for Dummies Questions & Answers | 2 | 06-13-2006 12:58 AM |
| exec command | g_s_r_c | Shell Programming and Scripting | 1 | 09-20-2004 09:20 AM |
| using the -exec command | moxxx68 | UNIX for Dummies Questions & Answers | 0 | 04-13-2004 11:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need help with -exec cp command.
I have a ksh script that contains the following:
find /dir1/dir2 -type f -name "FILE.*" -newer /dir1/dir2/afterme.txt -exec cp /dir1/dir2/dir3 {} \; When I run it from the cli, it runs fine. When I run it from the ksh script I get find: missing argument to `-exec' I also tried -exec cp {} ... and I still got the same error. What's the missing argument? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Assuming you want to copy the files to the directory /dir1/dir2/dir3:
Code:
find /dir1/dir2 -type f -name "FILE.*" -newer /dir1/dir2/afterme.txt -exec cp {} /dir1/dir2/dir3 \;
|
|
#3
|
|||
|
|||
|
At the bottom of my first post, I mentioned that I already tried it that way. Still got the same error.
Anyone else? |
|
#4
|
|||
|
|||
|
Anyone?
|
|
#5
|
|||
|
|||
|
Might the below script will help you ;
find /dir1/dir2 \(-type f -name "FILE.*" -a -newer /dir1/dir2/afterme.txt \) -exec cp {} /dir1/dir2/dir3/ \; Regards, |
|
#6
|
|||
|
|||
|
Quote:
Thanks but nah. It returned this error: find: invalid predicate `(-type' |
|
#7
|
|||
|
|||
|
You need a space after the opening parenthesis. It's not clear why you were getting the error message in the first place but maybe just retyping a different command coincidentally fixes whatever was wrong (missing characters? Random invisible characters?)
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|