Linked Questions

6
votes
2answers
181 views

Operations only on complete files [duplicate]

I have machine on which the files are uploaded by ftp. From this machine I would like to run cronjob and scp/rsync (simply copy them) to different machine in the same network. The problem is I don't ...
4
votes
1answer
219 views

Is there a way to cat files as they are created? [duplicate]

Unlike the answer to this question (Can a bash script be hooked to a file?) I want to be able to see content of files that haven't been created yet as or after they are created. I don't know when ...
25
votes
4answers
19k views

How to run a command when a directory's contents are updated?

There is a directory A whose contents are changed frequently by other people. I have made a personal directory B where I keep all the files that have ever been in A. Currently, I just occasionally ...
18
votes
3answers
34k views

How to use inotifywait to watch a directory for creation of files of a specific extension

I have seen this answer. You should consider using inotifywait, as an example: inotifywait -m /path -e create -e moved_to | while read path action file; do echo "The file '$file' ...
2
votes
2answers
3k views

Execute CURL command only once in script?

To explain a little, I am currently monitoring a folder for any changes and when changes are detected it simply uploads the detected files to my server via rsync. This is working without any issues : ...
3
votes
1answer
612 views

No output from inotifywait | awk

I'm attempting to use part of a one-liner found here: Script to monitor folder for new files? When I try the following procedure I get no output whatsoever and I cannot figure out why. In terminal ...
3
votes
1answer
434 views

Scan ~/Downloads on new file creation

I want all new files added to ~/Downloads (and sub-folders) to be scanned with clamscan. When using Firefox on other OSes/Machines I've noticed that downloaded files sometimes get automatically ...
1
vote
1answer
146 views

Alias to copy a file to a specific file

I have a scenario where I have a script that monitors a file location and that file location has files copied to it, i.e. /home/matt/thefile. I want an alias that if I do place myfile.txt it will ...
0
votes
1answer
272 views

File Watcher and send mail

I would like to make a script that detects a new file in different folders like: /home/pedro/XX/file1_082018.zip /home/pedro/XX/file2_082018.zip where XX indicates a non-fixed position country name ...
0
votes
1answer
237 views

Use diff and ls to detect files that changed in remote folder

I have a remote directory with read access. I want to generate a list of files that changed since last iteration. My idea is something like: $ cp output.new output.old $ ll > output.new $ diff ...
1
vote
1answer
44 views

Is it possible to automatically zip newly created files in a directory

Context I am required to use a poorly designed java application that logs A LOT of information while it is running. Under standard usage, it will create 100s of MB of logs per hour. I don't need ...
0
votes
0answers
49 views

Updating and renaming certain files

I have a shell script: #!/bin/bash while true do for name in /home/imp/imp/msgs/*.PK1; do mv "$name" "${name%.PK1}.BRD" 2>/dev/null >/dev/null done for name in /home/imp/imp/msgs/*.PK2; ...
0
votes
0answers
43 views

keep reading files in an updated dir

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 ...