I have a directory containing about 800 .tgz archives, each containing about 10 files. Effectively, I want to convert each archive into a directory of the same name. Is there a simple one line command to do this, or should I write a script?
I think you will need to script this. You can specify the directory that the extract is placed in by using the tar -C option.
The script below assumes that the directories do not exist and must be created. If the directories do exist the script will still work - the mkdir will simply fail.
tar -xvzf archive.tar.gx -C archive_dir
e.g.
for a in *.tar.gz
do
a_dir=`expr $a : '\(.*\).tar.gz'`
mkdir $a_dir 2>/dev/null
tar -xvzf $a -C $a_dir
done