-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41eb22b
commit 4c73a07
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |