I have a few thousand gzipped text files in different subdirectories and used a subset of these files as input for a project a few years ago. Back then I had an unzipped copy of the files I actually used in one directory, but deleted this and kept only a list of these unzipped files in that folder
This was my initial idea, LIST is the list of files. PARENTDIR is the toplevel directory in which all files reside in various sub directories. The idea was to find all the archives in whatever sub directory they are and gunzip them to NEWDIR
#!/usr/bin/env bash
LIST="listfile.txt"
PARENTDIR="/home/user/old/project"
NEWDIR="/home/user/old/project/2016"
while read line;
do
ARCHIVE="$(find $PARENTDIR -name "$line*")"
gunzip --stdout $ARCHIVE >$NEWDIR/$line
done <$LIST
I don't seem to get the find command right. It works without the variables, but not with, even without the command substitution, calling on the command line. My combination of quotes and wild cards is not quite correct, but I can't get it right, variable expansion doesn't help either and I guess I'm stuck...
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 240
تاريخ: چهارشنبه
9 تير
1395 ساعت: 15:22