Created
August 2, 2019 14:02
-
-
Save thiagomgo/46cefd4215cd4d827cedb0a74c1b523e to your computer and use it in GitHub Desktop.
Simple bash script to copy txt files to another directory.
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 | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
set -e | |
set -o pipefail | |
FROM="/tmp/FROM/" | |
TO="/tmp/TO/" | |
DATE=$(date '+%d-%m-%Y %H:%M:%S') | |
LOG_FILE=/scripts/rsync-txt-files.log | |
echo -e "Copying files txt from $FROM to $TO" | |
echo -e "=================================\n" >> $LOG_FILE | |
echo $DATE >> $LOG_FILE | |
rsync -avzh --out-format="%t %f %b" --include="*/" --include="*.txt" --exclude="*" "$FROM" "$TO" >> $LOG_FILE 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment