1

I have a bash shell script using inotifywait to capture files added to a specific Dropbox folder, running a process and saving the file to another Dropbox folder. I'm running PopOS 22.04.

For some reason, inotifywait is now saying $filename is .goutputfile-xxxx and not the actual file name. In earlier testing of this process, it did not do this.

I have found a forum page about commenting out set locking in nanorc config file, but this did nothing.

Below is the opening code to the bash shell script:

#!/bin/bash

#set time and date variables

TIMENOW="$(date +"%T")"
DATENOW="$(date +"%m-%d-%Y")"

#launch the inotifywait utility formatting output to just the file name and piping it into while function to process
#file is saved to Dropbox folder from the first part of a Zapier process

inotifywait -m -e create --format %f /home/dave/Dropbox/Inbound |
while read -r filename event; do

Please let me know what config file I need to edit or code I need to use to force inotifywait to use the actual file name and not the .goutputstream-xxxx name.

I tried editing the nanorc config file by commenting out set locking option per another forum post. This did nothing.

I need some way of capturing the actual file name, even if it is in a separate variable.

Nic3500
  • 8,144
  • 10
  • 29
  • 40
DLMatthews
  • 11
  • 1
  • 1
    Probably just a temporary file that's renamed to the actual one after it's been transferred over. – Shawn Jan 25 '23 at 19:43
  • @Nic3500 - that's what I"m guess. The script is running so fast that it is capturing the system's transfer name and not the file name. The problem is I don't know how to overcome this issue. Any suggestions? – DLMatthews Jan 26 '23 at 00:08
  • IF that is the case, that behavior is from the Dropbox client, not much you can do but ignore it via a grep maybe? The use of a temp file while a download occurs is to prevent incomplete files from being picked up while downloading. This was a common issue with ftp clients. – Nic3500 Jan 26 '23 at 15:23
  • It's not Dropbox. I tested without Dropbox involved and it did the same thing. Something is wrong with the InotifyWait code. I started using an If/Then statement to look for a new file and polling every 5 minutes with a Cron job. It is slower but at least it works. – DLMatthews Jan 28 '23 at 15:07

0 Answers0