Extract Specific Z File Method

I downloaded files from ftp:// via

wget -r -nc ftp://

distribution by years from 1998 to 2016 and per years contain 365 or 366 days

It contains these files (or similar) for each day

I want to extract only the files beginning with "codg"

1 Answer

Create a simple script which will extract files from the current directory.

cat > /tmp/extract.sh <<'EOF'
#!/bin/bash
for x in "$@"; do
  uncompress -f "${x}"
  rm -f "${x}"
done
EOF
chmod 755 /tmp/extract.sh

Then use a find command to iterate through the directories to do the operation of that script on every file.

find . -type f -name 'codg*.Z' -execdir /tmp/extract.sh {} +

The find command should be executed from the directory of your downloaded files. See find(1) man page and understand the options before executing.

5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest