I am looking for a way to exclude some files/folder and mass move files/folders with spaces and special characters from source to destination and then symlink after move completes. So far I have something like this.
#!/bin/bash
prev_dir=/test
new_dir=/dirtest2
cd $prev_dir
for i in `cat /scripts/files2move.txt`
do
sed -i 's/\r$//' $i
echo $i
cd $prev_dir
mv $i $new_dir && ln -s $new_dir $prev_dir
ln -s $i $new_dir $prev_dir
done
for
. – Kamil Maciorowski Aug 21 '20 at 04:37sed
to remove a carriage-return character, but it's unclear why this is part of a script that moves files. I'm also not sure about your call toln
with three pathname arguments, or why none of your variable expansions are quoted even though you say you work with filenames that has spaces and "special" characters in their names. – Kusalananda Aug 21 '20 at 06:58