Skip to content

Commit

Permalink
tard: tar a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
avindra committed Jan 16, 2025
1 parent 82b6fc7 commit a7d6704
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .local/bin/tard
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

# tar a folder (default = cwd)

folder="${1:-$PWD}"
name="$(basename "$folder")"

target="${name}.tar.gz"

printf "Creating %s from %s... " "$target" "$folder"

cd .. || { echo "Could not get parent dir"; exit 1; }

#--exclude-from=.gitignore \
tar \
--exclude=.git \
--exclude=.github \
--exclude=.gitignore \
--exclude=*.gz \
-zcvf \
"$target" \
"$name"

cd - || { echo "Could not switch back"; exit 1; }
mv "../$target" .

echo "done"

ls -lh "$target"

0 comments on commit a7d6704

Please sign in to comment.