Unused scripts
This commit is contained in:
1 parent
46845c4612
commit
9335b6d5da
2 files changed
-57
No files matched your search
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Ensure a directory is provided
|
|
||||||
if [ ! -d "$1" ]; then
|
|
||||||
echo "Usage: $0 <directory_path>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Go to the directory
|
|
||||||
cd "$1" || exit
|
|
||||||
folder_name="$(basename "$PWD")"
|
|
||||||
|
|
||||||
count=1
|
|
||||||
for file in *.pdf; do
|
|
||||||
# Handle case where no pdfs exist
|
|
||||||
[ -e "$file" ] || continue
|
|
||||||
|
|
||||||
if [ "$file" = "enonce.pdf" ] || [ "$file" = "énoncé.pdf" ] || [ "$file" = "$folder_name.pdf" ]; then
|
|
||||||
echo "Skipping: $file"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rename with 0-padding (e.g., Copie01.pdf)
|
|
||||||
mv -- "$file" "$(printf "Copie%02d.pdf" "$count")"
|
|
||||||
((count++))
|
|
||||||
done
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Check if an argument is provided
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Usage: $0 <directory>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to change into the directory, exit on failure
|
|
||||||
cd "$1" || { echo "Error: Cannot access directory '$1'"; exit 1; }
|
|
||||||
folder_name="$(basename "$PWD")"
|
|
||||||
|
|
||||||
# Enable nullglob: if no pdfs exist, the loop won't run once with "*.pdf"
|
|
||||||
shopt -s nullglob
|
|
||||||
|
|
||||||
for file in *.pdf; do
|
|
||||||
if [ "$file" = "enonce.pdf" ] || [ "$file" = "énoncé.pdf" ] || [ "$file" = "$folder_name.pdf" ]; then
|
|
||||||
echo "Skipping: $file"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rotate to a temporary file
|
|
||||||
if qpdf --rotate=+180 "$file" "temp_rotated.pdf"; then
|
|
||||||
mv "temp_rotated.pdf" "$file"
|
|
||||||
echo "Rotated: $file"
|
|
||||||
else
|
|
||||||
echo "Error processing: $file"
|
|
||||||
# Clean up temp file if pdftk failed but created garbage
|
|
||||||
[ -f "temp_rotated.pdf" ] && rm "temp_rotated.pdf"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
Reference in new issue
Block a user