Extract Specific Z File Method
I Downloaded Files from Ftp: // via Wget -R -Nc Ftp: // Distribution by Year's from 1998 to 2016 and per Year's Contain 365 or 366 Days It Contains These Files...
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.