login about faq

I've been very impressed with how sophisticated this software feels on Objective-C. So I was a little surprised to find the following and wanted to make sure I wasn't using it incorrectly:

  1. SFTP's createDir function doesn't work recursively.
  2. Attempting to create a directory that already exists results in a failure.

** I see that sftp itself lacks these abilities. So I wrote a method that splits the directory path into components and then loops while creating deeper directories. If it tries to create an already-created directory and fail's I'm going to have to ignore that failure. I'm troubled by ignoring those failures.

Best practice to recursively create directories while gracefully dealing with failures?

asked May 09 '15 at 12:34

ekh's gravatar image


Yes, the SFTP createDir does not work recursively. Your program would need to explicitly split the path into components and create each separately.

For the "directory already exists" failure: If it is easy to diagnose that the failure is for this reason, then I think it's best to let it fail and leave it to the application as to whether it should be ignored or not.


answered May 11 '15 at 12:53

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: May 09 '15 at 12:34

Seen: 1,916 times

Last updated: May 11 '15 at 12:53

powered by OSQA