Copy all files a user owns off of remote server
Published by Nicholas Dunbar on March 12th, 2013
This is for copying files from a Linux machine to a local Linux machine.
user@localhost the_directory> ssh user_name@remote_domain.com 'cd /dir/you/want/to/copy/; find `pwd` -user user_name' | xargs -I{} scp user_name@remote_domain.com:{} `pwd`
This connects to a remote server, gets a list of files a user owns and then secure copies all those files to your current directory on your local box.
Instructions:
open a terminal window on your local Linux box
type something like the following:
cd /dir/where/you/want/the/files/to/copy/
in the statement below replace the following:
user_name with the user who owns the files you want to copy (don't forget to replace it in both places)
remote_domain.com with the ip or address of the box from where you want to copy the files (don't forget to replace it in both places)
/dir/you/want/to/copy/ with the source directory on your remote host
then run the following command from above:
ssh user_name@remote_domain.com 'cd /dir/you/want/to/copy/; find `pwd` -user user_name' | xargs -I{} scp user_name@remote_domain.com:{} `pwd`