Tuesday, October 14, 2008
Scratching An Itch
Is there an option in 'tar' to add a file on an archive and delete it upon adding? Well, there is -r (append) but it can't add files to a gzipped file. Well, I came up with a small hack:
#!/bin/bash
for blah in `ls *.ext` # list the desired files
do
tar rvf foo.tar $blah ; rm -rf $blah # append and delete the added file on the archive
done
gzip foo.tar # zip the archive
------
I haven't scratched my other itch, that is a Jazz Bass, he he he.
#!/bin/bash
for blah in `ls *.ext` # list the desired files
do
tar rvf foo.tar $blah ; rm -rf $blah # append and delete the added file on the archive
done
gzip foo.tar # zip the archive
------
I haven't scratched my other itch, that is a Jazz Bass, he he he.
Labels: bash, delete, gzip, Linux, tar