Created
February 13, 2014 13:26
-
-
Save mherwig/8975010 to your computer and use it in GitHub Desktop.
Copy a folder to another using tar. This way you can easily (one-way) synchronize whole folders and exclude files e.g. .metadata
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
#!/bin/bash | |
# | |
# Author: Mike Herwig | |
# Description: | |
# Copy a folder to another using tar. | |
# This way you can easily (one-way) synchronize whole folders and exclude files e.g. .metadata | |
# | |
# Usage: | |
# tarcp ~/directory1" "~/directory2 | |
if [ $# -lt 2 ]; then | |
echo "Usage:" | |
echo "$0 source target" | |
exit 1 | |
fi | |
SOURCE=$1 | |
TARGET=$2 | |
tar -cf - -C "$SOURCE" --exclude ".metadata" . | (cd "$TARGET"; tar -xf - ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment