6

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?

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.