commit 38ac56379f1a707365bf45ea5a09c6fc8da47144 Author: Andrea Date: Sat Sep 26 20:58:21 2026 +0200 Initial commit diff --git a/filter photos.sh b/filter photos.sh new file mode 100755 index 0000000..63284ee --- /dev/null +++ b/filter photos.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for f in *.DNG; do [ ! -f "${f%.DNG}.JPG" ] && echo "Will remove $f"; done +read -p "Proceed? " answer + +case $answer in + [Yy]* ) for f in *.DNG; do [ ! -f "${f%.DNG}.JPG" ] && rm "$f"; done; exit;; + [Nn]* ) echo "Quitting.."; exit;; +esac diff --git a/kbshortcuts.sh b/kbshortcuts.sh new file mode 100755 index 0000000..ced88bb --- /dev/null +++ b/kbshortcuts.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +case "$1" in + -t) + sleep 0.2 + ydotool type "andrea.ferronato@telosalliance.com" + ;; + -m) + sleep 0.2 + ydotool type "ferronato.andre@gmail.com" + ;; + -l) + sleep 0.2 + ydotool type "andrea.ferronato@live.com" + ;; + -f) + sleep 0.2 + ydotool type "andrea@faerro.it" + ;; + -p) + sleep 0.2 + ydotool type "andrea.ferronato@arubapec.it" + ;; +esac diff --git a/pdfa-convert.sh b/pdfa-convert.sh new file mode 100755 index 0000000..1870260 --- /dev/null +++ b/pdfa-convert.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# 1. Check if both arguments were provided +if [ -z "$1" ]; then + echo "Error: Source folder not specified." + echo "Usage: $0 " + exit 1 +fi + +if [ -z "$2" ]; then + echo "Error: Output folder not specified." + echo "Usage: $0 " + exit 1 +fi + +# 2. Assign arguments to variables and resolve absolute paths +TARGET_DIR=$(cd "$1" 2>/dev/null && pwd) + +# 3. Check if the input directory actually exists +if [ -z "$TARGET_DIR" ]; then + echo "Error: Source directory '$1' does not exist." + exit 1 +fi + +# Set the final output path explicitly *before* creating or checking it +OUTPUT_DIR="$2/pdfa" + +# 4. Create the output directory if it doesn't exist +# This is the crucial fix for Ghostscript! +if [ ! -d "$OUTPUT_DIR" ]; then + echo "Creating output directory: $OUTPUT_DIR" + mkdir -p "$OUTPUT_DIR" +fi + +echo "Processing PDFs in: $TARGET_DIR" +echo "Saving outputs to: $OUTPUT_DIR" +echo "----------------------------------------" + +# 5. Loop through all PDF files (case-insensitive) +shopt -s nullglob nocaseglob +for pdf in "$TARGET_DIR"/*.pdf; do + filename=$(basename "$pdf") + echo "Processing: $filename..." + + # Run Ghostscript + gs -sDEVICE=pdfwrite \ + -dCompatibilityLevel=1.4 \ + -dPDFSETTINGS=/ebook \ + -dNOPAUSE \ + -dQUIET \ + -dBATCH \ + -sOutputFile="$OUTPUT_DIR/$filename_converted" "$pdf" + +done +shopt -u nullglob nocaseglob + +echo "----------------------------------------" +echo "Done! Converted files are in: $OUTPUT_DIR" \ No newline at end of file