Trying to count objects inside every folder inside the bucket (1 layer only)
Here is what i tried:
chcp 65001
Foreach($v in gsutil ls "gs://bucket/*"){
echo $v (gsutil ls $v).Length
}
It works fine at first, but there are 2 cases that cause errors:
- Folders containing "#" sign would cause the error "One or more URLs matched no objects."
- Folders containing Chinese Characters (i tried Chinese only) would have encoding issues, causing
$v
incorrect