Sftp download directory while excluding files with certain extension

6,704

Did you consider usind rsync (if you have it available)? It supports an --exclude option, where you can specify what you wish to exclude:

rsync -av foo@remotehost:/dir/ /localdir/ --exclude .ipa --exclude .ipa.*
Share:
6,704

Related videos on Youtube

Richard Knop
Author by

Richard Knop

I'm a software engineer mostly working on backend from 2011. I have used various languages but has been mostly been writing Go code since 2014. In addition, I have been involved in lot of infra work and have experience with various public cloud platforms, Kubernetes, Terraform etc. For databases I have used lot of Postgres and MySQL but also Redis and other key value or document databases. Check some of my open source projects: https://github.com/RichardKnop/machinery https://github.com/RichardKnop/go-oauth2-server https://github.com/RichardKnop

Updated on September 18, 2022

Comments

  • Richard Knop
    Richard Knop almost 2 years

    So I know I can download a whole directory like this:

    sftp> get -R *
    

    How can I exclude all files with .ipa extension though? I want to download everything except .ipa or .ipa.* files from a directory.

  • rubo77
    rubo77 about 4 years
    this is not a solution to the question. the question was, how to use sftp