Linked Questions

6 votes
2 answers

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 ...
s1c's user avatar
  • 597
4 votes
1 answer

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 ...
David Wilkins's user avatar
48 votes
8 answers

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' ...
Shy's user avatar
  • 597
34 votes
4 answers

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 ...
oadams's user avatar
  • 2,335
2 votes
2 answers

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 : ...
LopezNathan's user avatar
0 votes
1 answer

File Watcher and send mail

I would like to make a script that detects a new file in different folders like: /home/pedro/XX/ /home/pedro/XX/ where XX indicates a non-fixed position country name ...
Pedro Lopes's user avatar
1 vote
1 answer

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 ...
Crypteya's user avatar
  • 494
3 votes
1 answer

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 1: ...
cachance7's user avatar
  • 173
1 vote
1 answer

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 ...
NolanPower's user avatar
4 votes
1 answer

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 ...
ConfusedStack's user avatar
0 votes
1 answer

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.old $ ll > $ diff ...
Martin R.'s user avatar
0 votes
1 answer

Segmentation fault (core dumped) when using inotifywatch

I need to watch a file system for the creation of new files of a specific type. Thinking that this would be a perfect use case for inotifywatch, I set out to try and make something work. I went to the ...
Matt Camp's user avatar
  • 101
1 vote
0 answers

`touch` combined with `find -newer` behaves unexpected in script

Goal I was looking for a simple way to check for new files. As the target system is a minimal embedded Linux platform, I cannot just install more packages. Current Solution A nice solution seemed to ...
L. Heinrichs's user avatar
0 votes
0 answers

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 ...
LazyCat's user avatar
  • 178
0 votes
0 answers

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; ...
ignatius's user avatar
  • 401