9

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?

1
  • Tar'ing the files would be one way I can think of, the other would be to script it in a loop.
    – Josh
    Commented Jun 8, 2015 at 15:42

1 Answer 1

18

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .