CLI import / new asset instead of replacement

Hi Sebastian,

I used the new CLI import command this morning in an attempt to replace 190 wav files (in an “audio” folder) with new versions. This is for my app “daariz-somali1-course”. The command I used was:

.\cli\sq.exe assets import .\wav -t audio

Strangely, 40 of the uploads resulted in a new asset instead of a replacement. One such case is for the file “numbers-1-vo-acf.wav”.

I’m looking for clues as to why these particular 40 files (out of 190) were added as a new asset, but I’m stumped. The CLI tool said “Updating…succeeded” for these files, just like the others.

I have another 190 files to process, but first need to cleanup these duplicates and figure out what went wrong.

Any help is greatly appreciated!

-Barton

Can you send me a download link to your previous folder and current folder if possible? I can have a look the next days then.

Perhaps your file names are different? Windows is case insensitive but Squidex is case sensitive. Or there is an extra white space?

Sorry, I don’t understand what you mean by “download link to your previous folder and current folder”. Do you mean a folder containing the prior set of files and another containing the new set of files?

I don’t think the names are different, or have extra white space, but I’ll double check.

Thanks!

I think I found the problem. There weren’t as many duplicates as I first thought, and for those files that uploaded as a new version I found that the asset’s slug in Squidex was slightly different than the name of the file being uploaded. There was a dash ("-") in one position instead of an underscore ("_"). The name was the same as the file being uploaded, but not the slug.

Is there any way that I can scan all assets to look for this problematic situation, i.e. to compare the “name” to the “slug” (without the file extension)?

Or alternately, to regenerate slugs for all assets? (Clicking “generate” for the slug in the Squidex UI fixes the issue. We want all of our asset slugs to be the same as the filename.)

Great. You can automate everything with the API. Perhaps the source code of the CLI is a good starting point how to do that.

I’ll check it out. Thanks!

1 Like