mia icon indicating copy to clipboard operation
mia copied to clipboard

Cp does not support wildcards

Open BrianHanechak opened this issue 8 years ago • 1 comments

At least on Windows, I can't use a * wildcard to copy files from my local computer to the Algorithmia store.

The error I get looks like this:

Error uploading ./model.*: io error: The filename, directory name, or volume label syntax is incorrect. (os error 123)

BrianHanechak avatar Nov 08 '17 20:11 BrianHanechak

[catching up on issues - my apology]

Wildcard support when copying is currently limited to whatever your shell expands. For bash and similar, the shell expands * and similar to full paths, so algo cp *.png data://.my/images becomes something like algo cp /path/to/foo.png /path/to/bar.png data://.my/images which this CLI supports. Unfortunately, on Windows, I don't believe either cmd or Powershell expand wildcards, leaving it to each program to implement wildcard support.

I would like to see some glob support inside this CLI, primarily as a way to glob with remote paths, so it seems reasonable to also implement local globbing for Windows shells. However, I don't currently have any ETA for this. I can help you come up with specific cmd or powershell expansion loops if you have a particular scenario you need to support.

Implementation notes

I see 2 main implementation paths:

  1. Use FindFirstFile/FindNextFile Windows APIs directly via winapi crate. This would need feature flagged for just windows builds, and would be consistent with other Windows tools.

  2. Use glob's implementation. This looks very straight-forward, but might not exactly match Windows user expectations in corner cases. Also, since bash/zsh/etc... will still handle glob expansion before calling algo, this might be redundant and inconsistent (for example, algo cp *.png expanded by the shell might behave slightly differently than algo cp "*.png" expanded by algo).

(I currently lean slightly toward the first approach)

anowell avatar Jan 30 '18 20:01 anowell