Created
October 23, 2020 07:39
-
-
Save iamshreeram/4f7a6ebb3466965f2f95ce986c979f5f to your computer and use it in GitHub Desktop.
Live monitor for any new file creation and copy them to destn location : Used for write-only back-up for new files
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
srcdir="/tmp"; inotifywait -e close_write --format "%f" --monitor $srcdir | | |
while IFS= read -r line | |
do | |
echo $line | |
cp "$srcdir/$line" . #this would not replicate directories | |
# tar cf - "$line" | tar -C destination/ xf - #this should replicate directories | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment