Last active
December 4, 2017 10:26
-
-
Save tjirab/7d21d6e0522df0806c936acfad1840a5 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
# Parameters | |
FILES="file1 file2 file3 file4" | |
CURDATE=$(date +%Y%m%d) | |
SOURCE="/foo/bar/" | |
# Move files from eout to user dir | |
for FILE in $FILES; do | |
mv ${SOURCE}/${FILE} ${FILE} | |
done | |
# tar all files | |
tar -cf backup_${CURDATE}.tar $(echo ${FILES}) | |
# Compress tar | |
gzip backup_${CURDATE}.tar | |
# Remove all ordinary files that are not .tar.gz | |
find . -type f ! -name '*.tar.gz' -delete | |
# Decompress | |
gunzip <file> | |
# View files in tar | |
tar -tvf <tar> | |
# Unpack | |
tar -xf <tar> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment