Command to copy files/folders but skip bad/corrupt files??
I have a harddrive that's failing. I can only access the command line and I need to backup everything to my USB hard drive. Problem is some files are corrupt, so I'm doing cp - R /source /destination but as soon as it hits a bad file, it says file not found, or some sort of error and stops. Is there any way at all that I can tell it to copy a folder and all it's sub folders, and if it hits a bad file, just keep on going and skip it? Would make it so much easier.. thanks!
I had a similar problem and I could not remove the files because the stat failed. A fsck solved the problem.
It can happen that you loose some information when you perform a fsck. but you can run it first with the -N option to see what would happen.
I don't know how to automatically skip the corrupt files, I guess the dd command could help for a more low-level copy, skipping the filesystem problems (in fact, it has a noerror option), but I don't know exactly what options you should use. Check out this site if you want to try:
where this low-level copy command with dd is, for example:
# dd if=/dev/sda of=/dev/sdb conv=noerror
And, as I read there, there's another tool called ddrescue! Fine!
Tell us if it helps.
You can create a tar archive and exclude files from the archive.
I've used it to exclude complete directories, but my understanding of the man pages is that the -X option might be what you need.
|All times are GMT -5. The time now is 11:21 PM.|