Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I execute touch on all hard links to the file when saving a file?

I have a program that monitors the directory for a change, but some files have hard links on another directories, and it's not noticed if it's edited there.

share|improve this question

1 Answer 1

How do I execute touch on all hard links to the file when saving a file?

I don't know. But ...

I have a program that monitors the directory for a change, but some files have hard links on another directories, and it's not noticed if it's edited there.

So far as I can tell, tools like inotifywait can watch an arbitrary list of files, they don't have to all be in one directory.

--fromfile Read filenames to watch or exclude from a file, one filename per line. If filenames begin with @ they are excluded as described above. If is '-', filenames are read from standard input. Use this option if you need to watch too many files to pass in as command line arguments.

Therefore you might be able to define the set of monitored files by adding their pathnames to a text file rather than by making hard-links to them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.