CKinTX
New Member
- Joined
- Jan 21, 2020
- Messages
- 8
- Office Version
- 365
- Platform
- Windows
Good morning, all -
I download files from an SFTP site, but the files don't always have a unique name. Files on the site have a naming convention of File_Name.xls for the first file in the group and File_Name_X for each subsequent file in the set where X is an incrementing value from 1 to the total number of files - 1. So, if there are five files, they'll be;
My original plan was to write an Excel Macro to download the files, rename them and then upload copies of the newly named files back to the SFTP site, archiving them as I normally would. Unfortunately, during some manual testing of the renaming loop, I learned that the files, once downloaded, assume the current date as the creation date, giving them all the same name.
Blast, thought I.
So, my next plan was to rename the files while they still resided on the SFTP site, using the site parameters as a sort of drive alias. But, I've never been able to progress to this idea, because I can't get a connection to the SFTP site to save me.
I've found some WinSCP code that alleges to connect, but it has a USING statement - and other bits of code - that are VB.Net and, so, not compatible with Excel's macro basic. Well, at least, that's what I think the problem is, anyway. I couldn't get rid of the red squigglies. From what I could determine, it seems I have to have msinet.ocx on my computer. Unfortunately, that file is nowhere to be found and a Microsoft link to it gives me a 404 error.
Is there any way to set up a connection to an SFTP site such that I can do what I'm trying to do in renaming these files, or am I simply stuck doing it manually?
Thanx in advance for any assistance!
I download files from an SFTP site, but the files don't always have a unique name. Files on the site have a naming convention of File_Name.xls for the first file in the group and File_Name_X for each subsequent file in the set where X is an incrementing value from 1 to the total number of files - 1. So, if there are five files, they'll be;
- File_Name.xls
- File_Name_1.xls
- File_Name_2.xls
- File_Name_3.xls
- File_Name_4.xls
- File_Name.xls -> File_Name 2020-01-01.xls
- File_Name_1.xls -> File_Name 2020-01-02.xls
- File_Name_2.xls -> File_Name 2020-01-03.xls
- File_Name_3.xls -> File_Name 2020-01-04.xls
- File_Name_4.xls -> File_Name 2020-01-05.xls
My original plan was to write an Excel Macro to download the files, rename them and then upload copies of the newly named files back to the SFTP site, archiving them as I normally would. Unfortunately, during some manual testing of the renaming loop, I learned that the files, once downloaded, assume the current date as the creation date, giving them all the same name.
Blast, thought I.
So, my next plan was to rename the files while they still resided on the SFTP site, using the site parameters as a sort of drive alias. But, I've never been able to progress to this idea, because I can't get a connection to the SFTP site to save me.
I've found some WinSCP code that alleges to connect, but it has a USING statement - and other bits of code - that are VB.Net and, so, not compatible with Excel's macro basic. Well, at least, that's what I think the problem is, anyway. I couldn't get rid of the red squigglies. From what I could determine, it seems I have to have msinet.ocx on my computer. Unfortunately, that file is nowhere to be found and a Microsoft link to it gives me a 404 error.
Is there any way to set up a connection to an SFTP site such that I can do what I'm trying to do in renaming these files, or am I simply stuck doing it manually?
Thanx in advance for any assistance!