Skip to content

Instantly share code, notes, and snippets.

@ArneGockeln
Last active October 15, 2025 09:32
Show Gist options
  • Select an option

  • Save ArneGockeln/97be00e14c04d3428e5692a150e62e48 to your computer and use it in GitHub Desktop.

Select an option

Save ArneGockeln/97be00e14c04d3428e5692a150e62e48 to your computer and use it in GitHub Desktop.
makesteuern.sh - My way to collect invoices for the tax lawyer
#!/bin/zsh
# This script creates a workfolder, sub directories for account numbers, copies all invoices and creates a zip at the end.
# Created 15.09.2025
# check for parameters
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <YYYY>"
exit 1
fi
YEAR="$1"
DIR="steuern$YEAR"
# create work folder
mkdir $DIR
cd $DIR
# create folders
mkdir -p Bank/{300,301,visa}
mkdir Ausgang
# create subfolders
for i in {1..12}; do printf -v j "%02d" i; mkdir -p "${j}$YEAR"; done
# copy Belege files
for i in {1..12}; do printf -v j "%02d" i; find ~/Documents/Belege/$YEAR -name "*${j}$YEAR*.pdf" -not -path "*/ausgang/*" -exec cp {} "${j}$YEAR" \;; done
# copy Ausgang files
find ~/Documents/Belege/$YEAR/ausgang -name "*.pdf" -exec cp {} "ausgang" \;;
# copy Auszug files
find ~/Documents/Bank/2024 -name "*300*auszug*.pdf" -exec cp {} Bank/300 \;
find ~/Documents/Bank/2024 -name "*301*auszug*.pdf" -exec cp {} Bank/301 \;
find ~/Documents/Bank/2024 -name "*Kreditkarte*.pdf" -exec cp {} Bank/visa \;
# show results
tree .
# zip folder
cd ..
zip -r $DIR.zip $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment