1

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!

5
  • 1
    Do you use bash? Do you want to copy each sub-directory? (as I changed your question)
    – oHo
    Nov 15, 2012 at 8:31
  • I've flagged your question as exact duplicate, sorry :) The answer is here: superuser.com/q/216919/3374 Nov 15, 2012 at 8:37
  • Hi, well it's the macos shell.
    – Jem
    Nov 15, 2012 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, 2012 at 8:48
  • I'm actually surprised. This is actually a really old question being revived. @week should get a badge for this.
    – Joe
    Jan 28, 2020 at 2:05

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .