Solved

Upload to SFTP goes missing?


Badge +1

Hi Community.

 

I am putting together a workbench to upload specific (Plan) files to a SFTP and while I was there I thought I'd add in to download a list of existing files, match them against the options to upload and add/remove only what is necessary.

 

So in summary:

  • Get list of plans on network drive (file and path directory reader). Success!
  • Filter plan name against spatial file (determines if plan is needed or not). Success!
  • Download list of plans currently on the SFTP (FTP caller with SSH-Authentication). Success!
  • Filter needed plan names against plan names already existing on SFTP. Success!
  • Delete plan files from SFTP no longer needed (FTP caller with SSH-Authentication). Success!
  • Upload plan files to SFTP that are needed (FTP caller with SSH-Authentication). No success yet.

 

I'm happy to upload the template file I'm just not sure that will assist without the keys needed to access the SFTP (can't give these out).

 

WorkbenchThe creator/attribute manager are there for testing some of the different ideas I have had:

  • writing a pdf file from a local path
  • writing a pdf file from a network path
  • writing a pdf file from a UNC path

What is stumping me is that the delete and upload from/to the SFTP are very similar but not working.

 

The delete looks like this:

DeleteParameters 

The upload looks like this:

UploadParameters 

However when I look on the SFTP the deleted files have been removed but the uploaded files have not appeared.

 

Some of the resolutions I have tried for the upload:

  • Changing the URL path to the folder above the plans folder
  • Removing the trailing slash from the URL
  • Setting the file to upload path manually (including selecting from windows explorer)
  • Changing the transfer mode (we have both pdf's and tif's to upload and I thought this might change things)
  • Switching the connection mode between active and passive

 

Is there an extra step when uploading to a SFTP that I am missing or has anyone had similar issues?

 

Thanks FMErs

icon

Best answer by debbiatsafe 10 March 2023, 02:29

View original

3 replies

Badge +1

Hi FMErs again.

 

Quick update here.

I have had success (to a varying degree) with uploading files to the SFTP.

 

In summary:

I was testing uploading through a batch file calling WinSCP.

To get this working I found I needed to include the modifier -nopreservetime as the SFTP settings for this specific SFTP won't allow automated uploads with the preserve time stamp option.

In the end I have had to create a .bat file to populate with the upload string (containing the modifier above) for all targeted files then use the python shutdown script to call the batch file and watch all my files get uploaded.

 

I'll have to retry this with the system caller now I have the bat file process working (more updates if I am successful) but one question I do have is does anyone know how the FTP Caller handles these modifiers?

I suspect that there are some default settings that are applied and before I get an idea into the ideas board it would be good to know what I need to be asking for (expose modifier field to add to the connection string? checkboxes or dropdowns to add/remove modifiers?)

 

For those following along this is the set-up I have ended up with:

 

Output to batchThe creator and attribute manager add the echo and new line info to the batch.

The decelrator and concat build the string for the upload before adding it to the batch (may not even need the decel at this point).

 

Thank you.

Michael.

Userlevel 2
Badge +17

Hello @michaelbreen​ 

I'm glad to hear you have found a solution that is working for you.

When uploading and downloading files using the FTPCaller, the file name along with file extension is required in the URL. Based on your screenshot, the URL in the upload FTPCaller is a directory. Try adding a filename along with the extension.

You can use the FilenamePartExtractor transformer on the path_windows attribute to extract the filename with extension and append this value to the end of the upload URL.

Badge +1

Hi @debbiatsafe​.

 

That's exactly the solution.

I had thought we would just need to specify the folder in the URL location and the upload a file would specify the file name.

By including the file name we can see the files there.

 

Thank you very much for that.

Michael.

Reply