sshsftpputtypsftp

How do I exclude a subdirectory during get with psftp?


I am using the PuTTY psftp get command to download files recursively from a remote Unix server to my local PC and I need to exclude the vendor subdirectory.

The vendor folder lives under /var/www/html/project/ together with other files and folders.


Solution

  • psftp does not have such functionality.


    You would have to use another SFTP client. For example with WinSCP, you can use -filemask switch of its get command:

    get -filemask=|vendor/ /remote/path/* C:\local\path\
    

    There is also a guide for converting PSFTP script to WinSCP script.

    (I'm the author of WinSCP)