Created
January 22, 2015 08:20
-
-
Save pellepim/c26cd3ae270e6cf97c21 to your computer and use it in GitHub Desktop.
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
LOCAL_REPO_ABSOLUTE_PATH="/Users/jonn/code/main_service" | |
MOUNT_ABSOLUTE_PATH="/Volumes/pw-next/jon" | |
while true | |
do | |
sleep 1 | |
CHANGED_FILES=( $(find "$LOCAL_REPO_ABSOLUTE_PATH" -type f -ctime -5m -not -path '*/.*')) | |
for i in "${CHANGED_FILES[@]}" | |
do | |
FILE_PATH=${i#*"$LOCAL_REPO_ABSOLUTE_PATH"} | |
if [[ $FILE_PATH != *pp_config* ]] && [[ $FILE_PATH != *logs* ]] && [[ $FILE_PATH != *node_modules* ]]; then | |
if [ "$i" -nt "$MOUNT_ABSOLUTE_PATH""$FILE_PATH" ]; then | |
now=$(date) | |
echo "$FILE_PATH"" copied at ""$now" | |
cp "$i" "$MOUNT_ABSOLUTE_PATH""$FILE_PATH" | |
fi | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment