Skip to content

Instantly share code, notes, and snippets.

@pellepim
Created January 22, 2015 08:20
Show Gist options
  • Save pellepim/c26cd3ae270e6cf97c21 to your computer and use it in GitHub Desktop.
Save pellepim/c26cd3ae270e6cf97c21 to your computer and use it in GitHub Desktop.
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