27 lines
570 B
Bash
Executable File
27 lines
570 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ $# -ne 1 ]; then
|
|
printf "createarchive\n"
|
|
printf "usage: createarchive <folder to be archived>\n"
|
|
printf "warning: the archive will be moved to pwd (`pwd`)\n"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
# what this does in short: tar, compress, timestamp, shred the tar, mv .xz to pwd and display it
|
|
|
|
f=$1
|
|
|
|
thisfunc() {
|
|
tar cfv $f.tar $f && xz -vzk9e $f.tar -S .`date +%Y%m%d%H%M%S`.xz && shred -zuv $f.tar && mv $f.tar.xz . && ls -latr | tail -1
|
|
}
|
|
|
|
thisfunc
|
|
if [ `echo $?` -eq 0 ]; then
|
|
printf "done\n"
|
|
exit 0
|
|
else
|
|
printf "there were some errors\n"
|
|
exit 1
|
|
fi
|