Skip to content
Advertisement

Find and scp in one command

I need to scp all txt files in /home/data directory and its subdirectories.

JavaScript

The command seemed to work but on the destination server instead of a folder there was a file named testdir and it seemed to have the size of the last txt file that was transfered.

Am I missing something in the command?

Advertisement

Answer

Rsync may be more appropriate for the task. It has very handy include and exclude flags. You can use it like so:

JavaScript
Advertisement