Results 1 to 2 of 2
Hey everyone,
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 ...
- 04-02-2007 #1Just Joined!
- Join Date
- Apr 2007
- Posts
- 2
Terminal command to copy files and skip bad/corrupt ones?
Hey everyone,
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!
- 04-02-2007 #2
you could maybe use some sort of bash script and traverse the file structure in /source and copy all files to /destination.
If you dont need the same structure, then something like:should do.Code:find /source -type f -iname '*' -exec cp {} /destination \;
Otherwise, you could run some sort of find that will return the directory structure, and then do a similar find to above, but only on that subdirectory, and cp the files."I am not an alcoholic, alcoholics go to meetings"
Registered Linux user = #372327


Reply With Quote