I'd like to gunzip a directory full of compressed files and pipe the output (preserving the original files) to a different directory. I need the original names to stay the same. So...
gunzip -c *.gz > file/path/filename
# Search for all .gz in current directory and redirect output here. How do I grab the name of the file found using the wildcard?
Thank you for your help
Update: Final script below
FILES= /foo/bar/*.gz for gz in $FILES; do echo "unzipping $gz..." 1>&2 fn=$(basename $gz .gz) gunzip -c $gz > /new/foobar/$fn done