0

I have directory, that gets new .gz files during the day. I'd like to have a scripts that I start in the morning, and which keeps reading the data (and possibly processing it) as the new files are added. What would be the cleanest way to do it?

LazyCat
  • 188
  • 5
    Use something based on inotify if you are on Linux, or equivalent elsewhere. See https://stackoverflow.com/a/18692191 – Patrick Mevzek Jan 26 '18 at 19:09
  • also https://unix.stackexchange.com/questions/24952/script-to-monitor-folder-for-new-files – steve Jan 26 '18 at 19:16
  • @PatrickMevzek I'm hoping for a simpler solution, since I just need to read the files. Like if I execute 'awk '{}' the script will just keep reading the input. I want a similar functionality – LazyCat Jan 26 '18 at 19:20
  • 1
    See @steve reference: inotifywait -m /path -e create | while read path action file; do process "$file" ; done where process is your processing part. Put all of it in a file, add execute bits, and start it in the morning. – Patrick Mevzek Jan 26 '18 at 19:22

0 Answers0