Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got this ./image folder full of symbolic links to "real" folders. These "real" folder contain a series of images.

./image/stones -> somefolder/stones
./images/grass -> someotherfolder/grass
(etc.)

I try to run a script that will copy the contents of these folders from the ./image folder.

mkdir ../SCALE50

for dir in *; do

    echo $dir
    cp -R $dir/ ../SCALE50/$dir

done

the problem reported by command line is that

arch/*: Not a directory

I've almost no experience with command line, but I understand I should say "follow each symbolic link and copy the contents of that folder to the specified location".

Can't find how to phrase that in google. Thanks for your help!

share|improve this question
1  
Do you use bash? Do you want to copy each sub-directory? (as I changed your question) –  olibre Nov 15 '12 at 8:31
    
I've flagged your question as exact duplicate, sorry :) The answer is here: superuser.com/q/216919/3374 –  Artem Koshelev Nov 15 '12 at 8:37
    
Hi, well it's the macos shell. –  Jem Nov 15 '12 at 8:47
    
I'm trying to simply do: cp -L ./stones ../stones_as_folder to copy the folder pointed to by the "stones" symbolic link, but I end up with a copy of the symbolic link –  Jem Nov 15 '12 at 8:48

1 Answer 1

up vote 1 down vote accepted

rsync is what you need, look at parameters, you want -r recusive and --copy-links to copy destination file/dir instead of link.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.