How to netcat all the files in my directory?

5

3

I have a directory of files I'd like to netcat to another machine.

For one, I use

nc <ip> <port> < sample.fls

But if I have a directory of

sample1.fls
sample2.fls
sample3.fls
sample4.fls
sample5.fls
sample6.fls

How can I netcat all these files with one command?

Eric S.

Posted 2015-06-08T14:26:42.000

Reputation: 151

Tar'ing the files would be one way I can think of, the other would be to script it in a loop. – Josh – 2015-06-08T15:42:53.557

Answers

9

On receiver, go to destination directory and execute:

nc -l $tcp_port |tar xf -

then on sender:

cd sourcedirectory
tar cf - . | nc $destination_host $tcp_port

Tomasz Klim

Posted 2015-06-08T14:26:42.000

Reputation: 782