Re: Copying a bunch of images to one directory.



On 26 Nov., 02:28, Dave Kelly <daveekel...@xxxxxxxxxxxxxx> wrote:
On Nov 24, 4:40 pm, Janis Papanagnou <Janis_Papanag...@xxxxxxxxxxx>
wrote:> William's 'find' example collects the files from all subdirectories;
wasn't that what you wanted? Did you try the suggestions?

Janis

Tried this:
find -name '{*.jpg,*.png,*.JPG,*.gif}' -o -name
'{*.jpg,*.png,*.JPG,*.gif}' | xargs cp --target-directory=~/
xmasparty07
And got this error
cp: missing file argument

Tried this:
SilverNail:~/tffwebsite/httpdocs/images# find -name '*.jpg' -o -name
'*.jpg' | xargs cp --target-directory=~/xmasparty07
And got this error
cp: `~/xmasparty07': specified destination directory does not exist

Tried this:
find -name '*.jpg' --o name '*.jpg' | xargs cp --target-directory=/
root/xmasparty07
And got this error
cp: cannot stat `enhanced': No such file or directory
cp: cannot stat `1.jpg': No such file or directory
cp: cannot stat `./Belize2005/Norbert': No such file or directory
cp: cannot stat `Bonefish': No such file or directory
cp: cannot stat `at': No such file or directory

So I tried --o name "'*.jpg'" and -o name '"*.jpg"' and
still get the cannot stat errors.

Does the man page of your find command specifies to write two slashes
with option -o? Option 'name' requires a slash -name. Quoting of the
find arguments is necessary to prevent the shell to expand the names
to a matching file in the current directory and thereby producing
errors or wrong results; use just one pair of quotes, either single or
double (the latter in case you want to have shell variables inside the
string expanded before find is called). Try

find . -name "*.jpg" -o -name "*.gif" -o -name "*.png" -print0 |
xargs -0 cp --target-directory=/root/xmasparty07

Add more filename (patterns) by using a -o ("or") and -name.
(The 0 is a zero digit in case your font obscures it.)

Janis
.



Relevant Pages

  • Re: Copying a bunch of images to one directory.
    ... cp: missing file argument ... cp: cannot stat `enhanced': No such file or directory ... The iname option ignores case. ... The knack lies in learning how to throw yourself at the ground and miss. ...
    (comp.unix.shell)
  • Re: Copying a bunch of images to one directory.
    ... cp: missing file argument ... cp: cannot stat `enhanced': No such file or directory ... cp: cannot stat `Bonefish': No such file or directory ...
    (comp.unix.shell)