100
Views
3
Comments
[SFTP] Create folders if not exist
Question
sftp
Service icon
Forge asset by Paulo Ramos

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?

2020-07-29 19-08-40
Sanjay Kumar Sahu

it will create the folder if it does not exist. 


Regards,

Sanjay

UserImage.jpg
freek

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.

2012-03-02 13-17-21
Paulo Ramos
Staff

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. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.