'issue with swift container and relative/absolute path

I wrote a script which uploaded some files from a VM cinderblock to a swift object store. Unfortunately, I used a relative path to specify the file to upload.

For example:

$ swift upload container ../path/to/file.

Well swift apparently decided to interpret this relative path as a literal, so now the location of the file in the container is literally /../path/to/file

Unfortunately, this means that I cant download the file from the object store, because swift tries to maintain the directory structure and attempts to create a ".." directory and errors out. I've tried escaping with \, casting as a literal, downloading the entire container, but nothing is working.

Has anyone ran into this problem, or have any ideas to help me figure how to work around this?



Solution 1:[1]

You can either do this from the parent directory:

$ swift upload container path/to/file

Or use --object-name:

$ cd path/to
$ swift upload container file --object-name path/to/file

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1