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!

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

1 Answers1

2

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

karel
  • 13,390
  • 26
  • 45
  • 52
week
  • 3,298
  • 1
  • 13
  • 15