[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
"find -print0" will separate files with nulls. It can be piped into, eg. xargs, with the "-0" flag, which expects the same format. Very handy. find . -print0 | xargs -0 ls -l D On Tuesday 27 November 2007 00:24:58 Simon Williams wrote: > Arrghh. > > I thought I'd just about cracked this one, having discovered "sed s/' > '/'\\ '/g", but it's gone and bitten me again. Let's start from the > beginning... > > I have attached a broken hard disk which I'm trying to get files off. It > has the annoying failure condition in which it has lots of seek errors > and takes ages to recover if I happen to stumble across a bad block. As > an aside, if anyone knows how to tell the kernel to give up and reset > the drive immediately instead of waiting and trying 4-5 times that would > be the best solution. > > Also, if anyone knows how to tell dd to write zeros or something in > place of bad data and move on that would also be good (I tried > conv=noerror, but it never gives up, once it finds a bad block it keeps > trying to read that block forever). > > What I have at the moment is a list of files generated by find. Any > files which find couldn't get info for due to bad blocks are omitted > from the file, which should reduce the amount of drive resetting that > needs to go on later as I won't even be bothering to copy files which > have unreadable filesystem entries (please shout if this could mean I'm > going to miss data that I could still recover). > > What's stopping me at the moment is I can't actually work out how to get > any commands to use this list, because the names have spaces in. I get > this problem pretty much every time I try to do anything with a list of > files. Actually I got ls to work, but dirname won't have it. If I do it > manually on the command line it's fine: > > # dirname /mnt/usb/Documents\ and\ Settings/test > /mnt/usb/Documents and Settings > > but if I pass anything to it from another command it doesn't want to know: > > # dirname `echo /mnt/usb/Documents\ and\ Settings/test` > dirname: extra operand 'and' > # dirname `echo /mnt/usb/Documents\\ and\\ Settings/test` > dirname: extra operand 'and' > # dirname `echo /mnt/usb/Documents\\\ and\\\ Settings/test` > dirname: extra operand 'and\\' <-- just how did we make the leap from > 'and' to 'and\\' by adding only one '\'? > > The reason I want dirname to work is that I want to recreate the > directory tree. If I just used cp on each line then all the files would > end up loose on the same dir. Maybe this is the wrong way to go about it? > > This list has taken about 6 hours to generate, so running find again > with alternative arguments isn't an option. > > Ideas anyone? > > Thanks in advance. > Simon -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html