Last active
August 29, 2015 13:57
-
-
Save schnell18/9733270 to your computer and use it in GitHub Desktop.
Copy file unless it does not already exist in target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRC=/mnt/data/src1 | |
TRG=/mnt/data/trg1 | |
IFS=$'\n' | |
for f in $(ls -1 $SRC) | |
do | |
if [[ -d $TRG/$f || -f $TRG/$f ]]; then | |
echo "$f already exists!" | |
else | |
echo "Moving $f..." | |
mv "$SRC/$f" $TRG | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment