File size: 652 Bytes
89eca6b
 
 
 
 
 
 
 
3aa6f4a
89eca6b
3aa6f4a
 
 
 
 
 
 
 
 
 
89eca6b
 
3aa6f4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
### get script dir
SCRIPT_DIR=$(cd $(dirname $0); pwd)
### Specify the directory containing JSON files
TARGET_DIR=$SCRIPT_DIR/../export_annotated

# Process all JSON files in the target directory
for file in "$TARGET_DIR"/*.json; do
  # Step 1: Set imageData to null
  jq '.imageData = null' "$file" > tmp && mv tmp "$file"

  # Step 2: Check if imagePath contains a subdirectory and modify it if needed
  # jq '
  #   if .imagePath | contains("/") then
  #     .imagePath |= (split("/") | last)
  #   else
  #     .imagePath
  #   end' "$file" > tmp && mv tmp "$file"

  echo "Processed: $file"
done

echo "All files have been processed."