Is it possible to suspend/restart a 'find' command?

3

Let's say I have a slow filesystem in which I would like to list all the files:

find . -type f -printf "%p\n"

Is it possible to launch this command in a way I can interrupt it, save the state and relaunch it later on? I am not looking for a CTRL-Z kind of answers but more a solution behaving like if find would support a "-start-from-path" option.

mountrix

Posted 2016-02-03T01:45:44.040

Reputation: 146

Answers

3

The short answer is no.

For that functionality, you’d have to write a script that recurses through each sub-directory (either depth-first or breadth-first) and can efficiently saves its state in a temporary file to allow its resumption. It would be a non-trivial (but interesting) exercise and I’d recommend a high level scripting language such as Perl, Python or Ruby rather than a shell script.

Anthony Geoghegan

Posted 2016-02-03T01:45:44.040

Reputation: 3 095