Skip to content

inotifywait --include doesn't fire for files in newly created directories. #224

@jaimet

Description

@jaimet

(From this Stack Exchange post)

I want to run inotifywait to watch for all CREATEs of .txt files (recursively) under, let's say, the current directory. I run the following:

inotifywait -mr --event create --format '%e %w %f' --include '\.txt$' .

In another shell (from the same directory), I run the following:

touch 1.txt # inotifywait prints "CREATE ./ 1.txt" - all good.
mkdir mydir # inotifywait prints nothing - all good.
cd mydir    # inotifywait prints nothing - all good.
touch 1.txt # inotifywait prints nothing - NOT GOOD. I should have seen a "CREATE" message.

So despite me including the -r option (for which man inotifywait clearly states "Newly created subdirectories will also be watched."), my newly created subdirectory is clearly not being watched.

(FWIW, I'm running Debian GNU/Linux 12 (bookworm) and inotify-tools v3.22.6.0-4.)

This may be a dupe of #199.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions