One of our suppliers has started sending reports where the filename is suffixed with the date of the export and I can't work out using PuTTY psftp how to always pick up the file regardless of the change in file name.
This works for the exact file
get "TBD_7dayExport_20190628.csv"
What I'm looking to do is something like:
get "TBD_7dayExport" %
My aim is to pick up a new dated file every day, import and rename to TBD_7dayExport.
You can use
mgetcommand with a wildcard:But it won't allow you to rename the file to a fixed name. You would have to use some fancy batch file construct post-download. Something like this:
Removing part of filename with batch
Or use a more powerful SFTP client, which supports renaming files while transferring them.
For example with my WinSCP, you can do:
WinSCP GUI can generate a script/batch-file template for you.
Some resources:
Another option is PuTTY
pscp. It's less flexible than WinSCP, but can be just enough for your needs: