[Lilug] Quick question about find tar, and netcat
~ ~
hydratek at gmail.com
Wed Feb 25 21:04:18 PST 2009
Thank you gentleman for both your suggestions. I finally got it working as
such:
sender:
find . -name \*.mp3 -print0 | xargs -0 tar -czvf - | netcat 10.0.0.1 1234
receiver:
nc -l -p 1234 -q10 | pv -b > MP3.tgz
the -q will stop listening when it received EOF from netcat pipe. and the
pv -b gives me a idea of how much has been sent through the pipe.
-kupo
On Mon, Feb 23, 2009 at 12:26 AM, Akira <public at raideen.org> wrote:
> ~ ~ wrote:
>
>> I'm attempting to salvage some media files from a laptop that had windows
>> running on it. I've booted a livecd an I've connected another laptop to dump
>> to via firewire (works pretty awesome with eth1394) so I'm using netcat for
>> speed (over 10gb of media) . I want to do something along the lines of:
>> find . -name \*.mp3 -exec tar cfv - '{}' | netcat hostip 1234
>> receiving machine is doing :
>> netcat -l -p 1234 > Mp3.tar
>> but it's not working, mainly I think because I'm attempting to just create
>> with one file as oppossed to append them to the archive. so I've tried tar
>> with -r or -A but still no dice. What am I doing wrong here?
>>
>
> You forgot to escape the exec command:
> find . -name \*.mp3 -exec tar -cv {} \; | netcat hostip 1234
>
> Besides that, -exec will also call tar for every file unless you terminate
> it with a + so in your example, you're creating a new file every time.
> Appending doesn't work when outputting to stdout so you could do something
> like this instead.
>
> find . -name \*.mp3 -exec tar -cv {} + | netcat hostip 1234
>
> However, with 10GB of MP3s, I'd imagine that the file list would be very
> long so that's probably not a good idea. If you don't mind having the files
> extracted at the other end, you could do something like this:
>
> on the sender:
> find . -name \*.mp3 -exec tar -c {} \; | netcat hostip 1234
>
> on the receiver:
> netcat -l -p 1234 | tar -xv
>
> --Akira
>
>
> _______________________________________________
> Lilug mailing list
> Lilug at lilug.org
> http://lists.lilug.org/listinfo.cgi/lilug-lilug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lilug.org/pipermail/lilug-lilug.org/attachments/20090226/9d7d3e87/attachment-0003.htm>
More information about the Lilug
mailing list