I have corrupted filesystem. I would like to copy "survivors", remaining good files. So my question is -- how to copy only good files from one directory to another.
Please note, that for example one file can be 10GB and it is possible to copy 5GB of it. So if the tool responsible for copying uses target directory immediately to store copied content, it should remove such partial file as soon as it becomes clear it is impossible to copy entire file (because it is unreadable).
Good file -- a file which can be read from the beginning to the end without any I/O error.
Important: it should be done automatically, i.e. without user interaction (with user interaction I am already using Midnight Commander).
Update: for practical reasons it is required that maximum attempts to read the file can be specified, otherwise the tool could fall easily into infinite loop just trying read a file over and over again. So for example, if a given chunk of file cannot read (because of I/O error) and there was X tries -- assume the file is no good.