How to move files leaving symlinks behind?
How can I move/copy files from one directory to another, leaving the symlinks in the original directory. I know the ln -s
creates symlinks in the destination, but I want to leave the symlinks in the source directory and move the actual files to a new one. How can I do this?
Process the files individually, e.g.,
cd $original_directory
for i in <files to process> ; do
mv ./$i $new_directory/
ln -s $new_directory/$i ./$i
done
or, if copying, replace the mv
command line with
cp ./$i $new_directory/
rm ./$i