0

With reference to this...

/var/web/site/123/(everything inside) to /var/web/site/234/(everything from 123 BUT files are soft symlinked only)

how can this be done using 1 line? i dont want to save to another file etc and the directory input needs to be full directory /var/web/site/123 and not relative directory ./

Copy folder structure (without files) from one location to another. I want to keep the folder structure BUT only symlink the files.

Any takers on this? Using linux command line.

Rational for doing so:

The origin directory "123" is the default pristine work directory to clone new user's directory "234" to work from. So any new users, when they create their working directory, they can get from the original directory to carry on new work on their own directory.

There are subfolders with files need to take into consideration

1
  • Hmm. I don't think this is a good idea. If you use symlinks then user 234 modifies a file he will be modifying the original file used by user 123. Are you sure this is what you want to do?
    – DavidPostill
    Nov 22 '20 at 15:56
0

You can replicate folder structures like so

rsync -a -f'+ */' -f'- *' $SOURCE_DIR $DEST_DIR

And wildcards should let you symlink the files (see this answer)... I think you'll need to be careful to filter out subfolders though...

ln -s /tmp/one/* /tmp/two/
1
  • Copy folder structure (without files) from one location to another. I want to keep the folder structure BUT only symlink the files.
    – Noname
    Nov 22 '20 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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