Upload asset folder structure

@pauloamgomes Thanks for the concept. :slight_smile:

@gnagnu I wrote that cli command in the last hours. It is a feature, that I’m missing for a long time. I tested it only on my localhost on a Windows machine, but it seems to work well.

Usage:

$ ./cp assets-folder-import --dir "/e/cpimageimport" --list
cpimageimport
  0005_test.jpg
  ...
  test.txt
$ ./cp assets-folder-import --dir "/e/cpimageimport" --ext jpg,png --r --list
cpimageimport
  0005_test.jpg
  ...
cpimageimport > nature
  0017_test.jpg
  ...
cpimageimport > nature > flowers
  0037_test.jpg
  ...
cpimageimport > urban
  0001_test.jpg
  ...
$ ./cp assets-folder-import --dir "/e/cpimageimport" --ext jpg,png --r
Created new virtual folder nature - 5e90d8a39cb38e1b7c006d82
Created new virtual folder flowers - 5e90d8a39cb38e1b7c006d83
Created new virtual folder urban - 5e90d8a39cb38e1b7c006d84
Start to import assets. This may take a while...
Imported 1 of 16 files | mem: 4 MB | peak: 4 MB
...
Imported 16 of 16 files | mem: 30 MB | peak: 106 MB
Imported 16 assets in 52 seconds

The memory and the peak output is because the image import might break your memory limit (ColorThief and SimpleImage are two memory heavy libraries, that are called for each asset).

2 Likes