On 16/01/07, ChipEast at aol.com <ChipEast at aol.com> wrote:
Robert:
> I found your very helpful posting:
>http://sweetnam.eu/mediawiki/index.php/Using_Netcat_for_Backup> and had a couple of questions..... if you don't mind the intrusion
Well, I'm not Robert, but you CC'd ILUG, so I'll try to help...
[...] As a test, I ran the first line on the Linux box (Ubuntu 6.10, working
> great
> other than these file issues), then modified the 2nd line, the one for the
> Mac
> sending the files, to look like this:
>> tar jlcvPpf - /Users/chipeast/Desktop/EAST_NJNG13jan07/ >
> /dev/tcp/192.168.1.16/6666
Ok, this is where your first problem (the full directory structure being
created) comes from; the command above creates an archive of the directory
specified, but tells "tar" to use the full directory name, starting at /
Change this to:
cd /Users/chipeast/Desktop
tar cvf - EAST_NJNG13jan07 --exclude '.*' > /dev/tcp/192.168.1.16/6666
We're doing two things here - first of all using the relative pathname to
the EAST_NJNG13jan07 directory so that the full directory tree doesn't get
created, and secondly adding an exclude to prevent files beginning with a
dot from being included; this should eliminate the OS X metadata files from
being transferred. I've also removed the compression ("j") option from the
tar, as JPEG files don't really compress well enough to warrant the CPU
usage.
If you have more than one directory to be transferred, you can list several
on the "tar" command line above, or even use a wildcard - although if there
are very many, the wildcard might expand to more than the capacity of the
command line. Experimentation will reveal the best thing to do.
On the server, do:
cd /archive/pix_archive
nc -l -p 6666 | tar xvf -
That tells it to listen on the socket and pipe the results directly into the
tar expand command.
Should do everything you need.
Colm
--
Colm Buckley / colm at tuatha.org / +353 87 2469146
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!