Simplest way to send files over network
You're complicating your life needlessly. Use scp
.
To transfer a file myfile from your local directory to directory /foo/bar on machine otherhost as user user, here's the syntax: scp myfile user@otherhost:/foo/bar
.
EDIT: It is worth noting that transfer via scp/SSH is encrypted while transfer via netcat or HTTP isn't. So if you are transferring sensitive files, always use the former.
You can also try
python -m SimpleHTTPServer 8180
It will serve the files in directory in which it executed over HTTP, you can access it via Browser.
If you're happy with netcat
you can work around the file name issue by
intruducing tar
. This also simplifies sending multiple files at once as well
as sending directories.
On the sending side use:
tar cf - <files> | nc <host> <port>
And on the receiving side:
nc -l <port> | tar x
Another solution would be to use rsync
or scp
.