0

do you know how I could transfer all files with a particular extension (ex. txt files) from a server and keep the folder sctructure using SSH Secure File Transfer?

I'm using Win 7 Pro 64-bit, and I do have some advanced knowledge in computing (if that's required).

3
  • 2
    What do you mean by file of the same type?
    – heavyd
    Commented Oct 2, 2013 at 15:40
  • 1
    Thanks for editing the question, it seems file 'type' makes way more sense in portuguese than in english.
    – Firebug
    Commented Oct 2, 2013 at 16:52
  • @BrunoHeblingVieira 'file type' is ok. Maybe that commenter questioned what you meant because in your title you had written "from a given type" whereas 'of' would be the right term rather than from, Also though, file extension is technically better, if that's what you are specifying, and it is possible that a file's type isn't determined by its extension. The find command(the *nix one you can use via cygwin) might be able tp be amended to specify file type rather than extension i.e. regardless of extension. That would probably suit your purposes too
    – barlop
    Commented May 16, 2015 at 12:23

2 Answers 2

1

SSH alone does not transfer files but it allows transferring a stream of data and running commands on the remote computer.

This means that you can use any utility which will transform your files into a stream of data pass the stream through SSH and on the other end do the reverse process - extract the files from the stream. Below is an example with tar.

find /source/path -iname "*.ext" -print0 |
  tar --null -cf- -T- |
  ssh user@machine "tar -xf- -C /path/to/extract"

The command sequence can be on single line I added newlines for better readability. Probably only GNU tar has the --null and -T options.

If you do not have the suitable tools on your Windows you can install for example Cygwin.

1

Just in case anyone sees this question, I was able to achieve the same thing with FileZilla, using the Filter options.

You must log in to answer this question.

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