Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add function to create directories recursively #23

Closed
GlenDC opened this issue Sep 15, 2017 · 3 comments
Closed

add function to create directories recursively #23

GlenDC opened this issue Sep 15, 2017 · 3 comments

Comments

@GlenDC
Copy link

GlenDC commented Sep 15, 2017

The function would be added as a method to the client and could have the following signature:

func (c *Client) MkdirRecursive(path string) (string, error)

// an alternative name could be `Mkdirs`, I leave this up to you

I don't think it should ever fail if a directory already exist (no matter where in the path), but I'm open to suggestions on this part.

I'm proposing it as it seems like a generic enough feature that others might want it as well. If this seems like something you agree would be a nice addition to the lib than I wouldn't mind putting development time in to get this added as a PR.

For now I already have a first version ready, which probably has plenty of room for improvement, but it might help give the idea and show my willingness to help get this feature in this library. You can find an initial (perhaps prototype?) version I made for my project at: https://github.com/zero-os/0-Disk/blob/196c18e382ae839c9fee9bca457bea49890539ce/nbd/ardb/backup/storage_ftp.go#L214-L260

@muirmanders
Copy link
Contributor

Thank you for the suggestion. I want to keep the client API simple (i.e. close correspondence to the actual FTP commands). I would be open to a separate package "ftputil" (a la "ioutil") or similar that has these kinds of useful functions. The signature could be something like MkdirAll(*goftp.Client, string) (string, error) ("MkdirAll" is consistent w/ std lib naming).

@GlenDC
Copy link
Author

GlenDC commented Sep 17, 2017

That sounds like a reasonable approach to me. In the course of the next week I'll try to allocate some time and open a PR for it, so we can take it from there.

@muirmanders
Copy link
Contributor

Closing due to inactivity. Please re-open if you want to keep working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants