Sunday, August 10, 2008

unix pipe at work

I wanted to copy a large amount of files into my iTunes library.
Bummer, a computer got disconnected right in the middle, after 5 hours of copy...
how do I resume where it stopped ?
I saw that every directory u until letter D was already copied.
After a few tinkering, I finally found how to not repeat the copy already made :
find . -maxdepth 1 |  | grep '^..[C-Z]+*' | tr '\012' '\000' | xargs -0 -Ifrom cp -Rvf from /bibliotheque/music
There you go
edit : added the | tr '\012' '\000' | xargs -0 step that permits to circumvent the old misunderstanding between \n and null terminated entries

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home