[oclug]an actual linux question ;-)

Rosberg, Michael m.rosberg at telesat.ca
Fri Jan 24 13:46:22 EST 2003


-----Original Message-----
From: gabriel [mailto:the.angel.gabriel at rogers.com]
Sent: Friday, January 24, 2003 1:31 PM
To: oclug at lists.oclug.on.ca
Subject: [oclug]an actual linux question ;-)


i have a bunch of files in a directory that are, in turn separated into 
subdirectories:

x-+
  +-a-+
  |   +-1.gif
  |   +-2.gif
  |   +-3.gif
  |
  +-b-+
  |   +-4.gif
  |   +-5.gif
  |   +-6.gif
  |
  +-c-+
      +-7.gif
      +-8.gif
      +-9.gif

anyone know of a bash on liner to copy all those gifs to another directory 
WITHOUT their directory structure?  i've been experimenting with find & xargs 
but i haven't been able to get it to work yet...

thanks



This crude solution is more than one line...but should do the trick. Run the following from directory x:

for i in `ls -R | grep *gif ; do
   cp $i /new_directory/
done



More information about the OCLUG mailing list