Skip to content

Globs #38

@stevenvachon

Description

@stevenvachon
cpr("/path/to/dir/", "/dest/")
//-> copies contents of /path/to/dir/ into /dest/

cpr("/path/to/dir/**/*", "/dest/")
//-> same as above

cpr("/path/**/dir/", "/dest/")
//-> same, and possibly more if there're other nested dirs named "dir"

When/if glob expands directories, we can use glob.Glob to copy each file as it is expanded from the glob. This is not only better because it helps avoid race conditions by copying the file immediately after it's expanded, but it may also have better performance because the hard drive has already sought to that track/sector.

Since a glob will likely resolve to many files, we might as well implement #41 along with this. An instance of glob.Glob per glob and file paths memoized to avoid redundancy.

cpr(["/path/to/dir/", "/path/to/dir/**/*", "/path/**/dir/"], "/dest/")
//-> same as above, with no file copied more than once

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions