Skip to content

Instantly share code, notes, and snippets.

@theagoliveira
Last active January 25, 2022 05:34
Show Gist options
  • Save theagoliveira/f918aa349ac64b25dc45faf691e2b40b to your computer and use it in GitHub Desktop.
Save theagoliveira/f918aa349ac64b25dc45faf691e2b40b to your computer and use it in GitHub Desktop.
Recreate LaTeX project directory structure inside build folder
#!/usr/bin/env bash
# SOURCE: https://tex.stackexchange.com/questions/323820/i-cant-write-on-file-foo-aux/485273#485273
# find all directories which are not the destination dir or inside it
find "$1" -maxdepth 1 -type d -not -name "$2" -not -path "$1/$2/*" -not -path "$1" -printf '%P\n' \
| while IFS= read -r dir
do
cp -r "$1/$2/${2}_$3/$dir" "$1/$2"
done
#!/usr/bin/env bash
# SOURCE: https://tex.stackexchange.com/questions/323820/i-cant-write-on-file-foo-aux/485273#485273
# find all directories which are not the destination dir or inside it
find "$1" -maxdepth 1 -type d -not -name "$2" -not -path "$1/$2/*" -not -path "$1" -printf '%P\n' \
| while IFS= read -r dir
do
cp -r "$1/$2/$dir" "$1/$2/${2}_$3"
done
#!/usr/bin/env bash
# SOURCE: https://tex.stackexchange.com/questions/323820/i-cant-write-on-file-foo-aux/485273#485273
# find all directories which are not the destination dir or inside it
find "$1" -type d -not -name "$2" -not -path "$1/$2/*" -printf '%P\n' \
| while IFS= read -r dir
do
mkdir -p "$1/$2/${2}_$3/$dir"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment