Skip to content

Instantly share code, notes, and snippets.

@BoredHackerBlog
Created December 5, 2020 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoredHackerBlog/665540695e8e7e92489d4a1850d8bdd0 to your computer and use it in GitHub Desktop.
Save BoredHackerBlog/665540695e8e7e92489d4a1850d8bdd0 to your computer and use it in GitHub Desktop.
# This is for monitoring a folder (recursive) and copying files that were saved into a new folder
# apt install inotify-tools
# https://linux.die.net/man/1/inotifywait includes events
# command below does copy after close_write event
inotifywait -q -m -r -e close_write --format '%w%f' myfiles/ | while read afile; do cp --parents -r $afile /tmp/; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment