// Mkdir creates a directory with the given path.
// If the path already exists and is a directory, Mkdir returns no error.
326597
func (c *Context) Mkdir(path string) error {
	if ae != nil {
		return ae.Mkdir(c.ae, path)
	}
	return c.mkdir(path)
}
543098
func (f *FakeFS) MkdirAll(dirName string, perm os.FileMode) error {
	_, err := f.Create(dirName)
	return err
}
429689
func (c *Client) Mkdir(path string, _ os.FileMode) error {
	path = FixSlashes(path)
	status := c.mkcol(path)
	if status == 201 {
		return nil
	}

	return newPathError("Mkdir", path, status)
}
729538
func createDirectory(dir string, perms os.FileMode) error {
	// This prevents someone passing /path/to/dir and 'dir' not being created
	// If two '//' exist, MkdirAll deals it with correctly
	dir = dir + "/"
	return os.MkdirAll(dir, perms)
}
595847
func mkdir(am auth.AuthMode, children []blob.Ref) (blob.Ref, error) {
	cl, err := client.New(client.OptionAuthMode(am))
	if err != nil {
		return blob.Ref{}, err
	}
	var newdir blob.Ref
	ss := schema.NewStaticSet()
	subsets := ss.SetStaticSetMembers(children)
	for _, v := range subsets {
		// TODO(mpl): make them concurrent
		if _, err := cl.UploadBlob(context.TODO(), v); err != nil {
			return newdir, err
		}
	}
	ssb := ss.Blob()
	if _, err := cl.UploadBlob(context.TODO(), ssb); err != nil {
		return newdir, err
	}
	const fileNameLayout = "20060102150405"
	fileName := "shared-" + time.Now().Format(fileNameLayout)
	dir := schema.NewDirMap(fileName).PopulateDirectoryMap(ssb.BlobRef())
	dirBlob := dir.Blob()
	if _, err := cl.UploadBlob(context.TODO(), dirBlob); err != nil {
		return newdir, err
	}

	return dirBlob.BlobRef(), nil
}
1111370
func CopyDir(source string, dest string) error {
	// Get properties of source.
	srcinfo, err := os.Stat(source)
	if err != nil {
		return err
	}

	// Create the destination directory.
	err = os.MkdirAll(dest, srcinfo.Mode())
	if err != nil {
		return err
	}

	dir, _ := os.Open(source)
	obs, err := dir.Readdir(-1)
	if err != nil {
		return err
	}

	var errs []error

	for _, obj := range obs {
		fsource := source + "/" + obj.Name()
		fdest := dest + "/" + obj.Name()

		if obj.IsDir() {
			// Create sub-directories, recursively.
			err = CopyDir(fsource, fdest)
			if err != nil {
				errs = append(errs, err)
			}
		} else {
			// Perform the file copy.
			err = CopyFile(fsource, fdest)
			if err != nil {
				errs = append(errs, err)
			}
		}
	}

	var errString string
	for _, err := range errs {
		errString += err.Error() + "\n"
	}

	if errString != "" {
		return errors.New(errString)
	}

	return nil
}
781269
func MkdirAll(targetDirectory string, mode os.FileMode) error {
	err := os.MkdirAll(targetDirectory, mode)
	if err != nil {
		return trace.ConvertSystemError(err)
	}
	return nil
}
742293
func (fp FsPath) Mkdir(perm os.FileMode) error {
	return fp.Fs.Mkdir(fp.Path, perm)
}
60670
func (b *Browser) MkdirAll(_ string, _ os.FileMode) (err error) {
	return errors.New("browser cannot mkdir")
}
1019890
func (fs *FS) MkdirAll(filename string, perm os.FileMode) (err error) {
	fs.log.CDebugf(fs.ctx, "MkdirAll %s", filename)
	defer func() {
		fs.deferLog.CDebugf(fs.ctx, "MkdirAll done: %+v", err)
	}()

	if err := fs.requireNonEmpty(); err != nil {
		return err
	}

	return fs.mkdirAll(filename, perm)
}
945885
func (l *httpFileSystem) MkDir(path string, mode int) error {
	return trace.BadParameter("directories are not supported in http file transfer")
}
242594
func CopyDir(source string, dest string) (err error) {

	// get properties of source dir
	fi, err := os.Stat(source)
	if err != nil {
		return err
	}

	if !fi.IsDir() {
		return errNotDir.Format(source)
	}

	// create dest dir

	err = os.MkdirAll(dest, fi.Mode())
	if err != nil {
		return err
	}

	entries, err := ioutil.ReadDir(source)

	for _, entry := range entries {

		sfp := source + PathSeparator + entry.Name()
		dfp := dest + PathSeparator + entry.Name()
		if entry.IsDir() {
			err = CopyDir(sfp, dfp)
			if err != nil {
				return
			}
		} else {
			// perform copy
			err = CopyFile(sfp, dfp)
			if err != nil {
				return
			}
		}

	}
	return
}
587515
func Wdir() string {
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(err.Error())
	}
	return dir
}
1071030
func (e *EtcdStore) Mkdir(path string, ttl time.Duration) error {
	c, q := context.WithTimeout(context.Background(), e.Timeout)
	defer q()

	o := &client.SetOptions{Dir: true, TTL: ttl}
	return set(e, c, o, path, "")
}
159619
func MkdirAll(dirpath string) error {
	// TODO: am I swallowing err?
	if _, err := os.Stat(dirpath); os.IsNotExist(err) {
		return os.MkdirAll(dirpath, os.ModeDir|0700)
	}
	return nil
}
864559
func StatDir(path string) (os.FileInfo, error) {
	fi, err := os.Stat(path)
	if err != nil {
		return nil, trace.ConvertSystemError(err)
	}
	if !fi.IsDir() {
		return nil, trace.BadParameter("%v is not a directory", path)
	}
	return fi, nil
}
762057
func (fs *FS) Mkdir(name string, perm os.FileMode) error {
	return fs.Filesystem.Mkdir(fs.PrefixPath(name), perm)
}