Created
April 19, 2021 07:37
-
-
Save gamesbook/a60c42cae94cbb815ab7eb2e4230cc96 to your computer and use it in GitHub Desktop.
Copy files from source directory if they already exist in destination
This file contains 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
#!/bin/bash | |
for file in /src/*; do | |
cfile="${file##*/}" | |
if [ -f "/dest/${cfile}" ] | |
then | |
echo "${cfile}" | |
cp "/src/${cfile}" "/dest/${cfile}" | |
touch "/dest/${cfile}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment