Skip to content

Commit

Permalink
Create organize_by_stop_id.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-vasconcelos committed Jul 10, 2024
1 parent 41eb22b commit 4c73a07
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions organize_by_stop_id.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Iterate over each PDF file in the current directory
for file in *.pdf; do
# Check if the file exists to avoid errors when there are no PDFs
if [ -e "$file" ]; then
# Extract the stop ID (6 digits before the .pdf)
stop_id=$(echo "$file" | grep -o '[0-9]\{6\}\.pdf' | cut -d '.' -f 1)

# Create a directory for the stop ID if it doesn't exist
mkdir -p "$stop_id"

# Move the file into the corresponding directory
mv "$file" "$stop_id/"
fi
done

0 comments on commit 4c73a07

Please sign in to comment.