0

I would like to create symlinks from all files and files in the sub-folders in a new folder. So, it makes a new folder, and in this new folder it mirrors the actual folder structure from the source folder (real folders, no symlinks) and creates symlinks to all files. Like this:

source folder

folder1
folder2
folder3
folder3/file1
file2

new folder

folder1
folder2
folder3
folder3/symlink: file1
symlink: file2

I heard of "recursive" but I don't know how to do that in debian. I hope someone can help me.

0

Use the -s parameter of cp:

cp -rs /source/dir/* /target/dir/

Folder will be created. Files will be absolute links to the original folder structure.

0
0

using bash script:

cd sourcedir
destdir=my-dest-dir-path
for dir in `find . -type d`; do [ "$dir" != "." ] && mkdir -p $destdir/$dir ;done
for file in `find . -type f`; do ln -s $file $destdir/$file; dir

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.