Don't try this at home, folks!
bkil@work /home/bkil/1 $ tar --remove-files -cvzf 1.tar.gz .
./
./1.sh
./cp_ln.sh
./cp_ln.sh.
./format.mysql.txt
(...)
./test2.sh
./things_for_my_blog.tar.bz2
./wc-c
./wgetd.sh
./very_important_files.tar.bz2
./1.tar.gz
tar: ./1.tar.gz: file changed as we read it
tar: .: Cannot rmdir: Invalid argument
tar: Error exit delayed from previous errors
bkil@work /home/bkil/1 $ ls
bkil@work /home/bkil/1 $ ls -a
. ..
bkil@work /home/bkil/1 $
Thankfully, I could reconstruct every import file from my backups except for some uninteresting logs. I have compressed "." before, and I have also used the "--remove-files" switch many times, but it looks like I rarely combine the two. Now I remember why! :) I should have written either "cd ..&&tar --remove-files -cvzf 1.tar.gz 1" or "tar --remove-files -cvzf 1.tar.gz * .[^.]* ..?*"
By the way, if you would like to know more on the strange 'Cannot rmdir: Invalid argument' error message, please visit the following Debian bug report:
ReplyDeletermdir -p ./foo literally tries to rmdir .