CLI sync / upload_dir fails to upload images
I'm running Python 3.8.2 in PowerShell on Windows 10.
I have a folder structure containing 2025 images (202 mb in size) which contains images from our WordPress blog. They are in the standard YYYY/MM folder structure.
I've tried the following commands:
cld -C "myconnection" sync --push blog blog
cld -C "myconnection" upload_dir ".\blog\2013\"
Each results in every upload failing with an error of this kind:
error: Failed uploading C:\Temp\images\blog\2013\03\IMG_06481.jpg, error: public_id (2013\03/IMG_06481) is invalid.
I can manually upload the file, so I'm wondering if it's a CLI bug.
Many thanks!
-
Hi endjin,
Please refer: https://cloudinary.com/documentation/cloudinary_cli#sync on how to syn assets between a local directory and your Cloudinary account directory.
Here is an example:
my local directory is: /Users/moip/Desktop/ticket_120834/images/blog/2013/03
and my Cloudinary directory is set up as: blog/2013/03
moip@Mos-MBP-2 03 % cld sync --push "/Users/moip/Desktop/ticket_120834/images/blog/2013/03" "blog/2013/03"
Found 2 items in local folder '/Users/moip/Desktop/ticket_120834/images/blog/2013/03'
Found 0 items in Cloudinary folder 'blog/2013/03'
Uploading 2 items to Cloudinary folder 'blog/2013/03'
Successfully uploaded /Users/moip/Desktop/ticket_120834/images/blog/2013/03/rustic.jpeg as blog/2013/03/rustic
Successfully uploaded /Users/moip/Desktop/ticket_120834/images/blog/2013/03/beauty.jpeg as blog/2013/03/beautyRegards,
Mo
0 -
Hi Mo,
Thanks for the quick response. I believe I was using the CLI correctly. I've tried it again, and still the same problem.
I'm wondering why I'm getting the following error:
error: Failed uploading C:\Temp\images\blog\2013\03\IMG_06481.jpg, error: public_id (2013\03/IMG_06481) is invalid.
What's making me suspicious is the final bit:
public_id (2013\03/IMG_06481) is invalid.
I would expect the public_id to be (2013\03\IMG_06481) not (2013\03/IMG_06481) (note the difference in the final slash).
0 -
I'm also slightly suspicious that this is a "path" bug with Windows - If I look at your example
moip@Mos-MBP-2
I take it you are trying this on a MacBook Pro?
0 -
Hi Endjin - thanks for bringing this to our attention!
I've implemented a fix in the GitHub repository on the `fix/windows_path_format` branch here. Note that in order to match Cloudinary's folder syntax, `2013\03\IMG_06481` should now be uploaded as `2013/03/IMG_06481` rather than keeping the Windows folder separator `\`.
Could you try installing the fixed version from the repository and let me know if it solves your issue?
git clone -b fix/windows_path_format https://github.com/cloudinary/cloudinary-cli
pip3 install -e cloudinary-cli0 -
Hi Brian,
just trying it out.
I've also just issued a PR to add guidance for setting up the CLI in PowerShell (the "set" command behaviour is different than using cmd.exe).
https://github.com/cloudinary/cloudinary-cli/pull/14
Regards,
Howard
1 -
Yay! That works. Thanks very much for the quick turnaround.
Regards,
Howard
0 -
Hi Howard,
Glad it works, and thanks for the pull request! I went ahead and merged it.
Best,
Brian
0
Post is closed for comments.
Comments
7 comments