0

Possible Duplicate:
How can I copy a subset of files from a directory while preserving the folder structure?

I have a bunch of directories like this:

/Artists/Example Name 1/Images/Lo-res/ /Artists/Example Name 2/Images/Lo-res/ /Artists/Example Name 3/Images/Lo-res/ 

I want to use the cp command to copy all the contents of all of the "Lo-res" directories to another location while keeping their preceding directory structure (the name and images directories) intact.

I've been trying this

cp -R /Artists/*/Images/Lo-res /New_Location/ 

But that just copies all the files into one new Lo-res folder.

Can anyone help?

2
  • That's what cp does. I think you need to use something else to get the effect you want, such as tar. Commented Nov 29, 2012 at 23:08
  • 2
    Check out rsync and its filter rules Commented Nov 29, 2012 at 23:10

1 Answer 1

0

rsync -av /Artists/*/Images/Lo-res/ /New_location/

the trailing / characters on the source and destination directories are very important to rsync to attain the effect you want.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.