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 a96b9d8
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 $target from ${folder}... "

cd .. || exit

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

cd -
mv "../$target" .

echo "done"

ls -lh "$target"

0 comments on commit a96b9d8

Please sign in to comment.