[SFTP] Create folders if not exist

Forge Component
(15)
Published on 21 Jul (3 weeks ago) by David Epps
15 votes
Published on 21 Jul (3 weeks ago) by David Epps

When I do a put to a directory that does not exists I first have to create all the folders before I can do the put is that normal or should the put function create the folders automatically?

it will create the folder if it does not exist. 


Regards,

Sanjay

Hi Sanjay,

I tried to create upload a file by:

/2020/07/01/filename.pdf


It gave me a error about parent node not found or something.

Then when I created the folders /2020/07/01/ by hand and did again the placing of the file it worked.


Also the mkdir is not working with creating multile folders at once only if you first create 2020 then /2020/07 and then 2020/07/01 it works.

Hi,

Not sure if it's supposed to work that way... it seems more susceptible to undesired behaviors and less control.

Anyway, if you really need to, you can use String_Split to find all those folders and create them individually (top-down). Encapsulate that in a SS module, and you don't even need to change the extension C# code.