posted 15 years ago
Have you tried executing this on the shell? Like this:If you have, you'll see that Bash (I assume that's the shell you're using) expands the spaces into separate filenames, treating the quotes as part of the words. So the cp command is actually seeing these files:
'abc345temp.pdf''pqs_234.pdf'which isn't what you want.
There are a couple of changes you can make. The first is to use the xargs command, like this:That should work.
Alternatively, you can change Bash's token identification delimiter. So rather than using quote marks and Bash interpreting the spaces as delimiters, you can separate filenames with any other delimiter character not likely to appear in each name. Common examples are a newline or a colon, or any other character you know won't be found in the filenames. I'll go with the latter:Note you will need to put IFS back to the original value after running the command as that change will likely break other parts of your script.
Post back if that works or doesn't work for you...
[ December 10, 2008: Message edited by: Charles Lyons ]
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )