Skip to content

Commit

Permalink
Update compare_files.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryRyumin committed Feb 8, 2024
1 parent f472bcf commit dabe96d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/compare_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ files_to_update=()
if [ -d "$TARGET_DIR" ]; then
find "$SOURCE_DIR" -type f -name '*.json' -print0 | while IFS= read -r -d '' file; do
relative_path="${file#$SOURCE_DIR/}"
target_file="$TARGET_DIR/$relative_path"

# Extract the year and the rest of the path
year=$(echo "$relative_path" | awk -F'/' '{print $1}')

# Remove the year from the relative path
target_file="$TARGET_DIR/${relative_path/${year}\//}"

echo -e "${target_file} ${year}"

if [ -e "$target_file" ]; then
# Check if files differ
Expand Down Expand Up @@ -56,4 +63,4 @@ else
for updated_file in "${files_to_update[@]}"; do
echo -e "${GREEN}$updated_file${NC}"
done
fi
fi

0 comments on commit dabe96d

Please sign in to comment.