Computing.Net > Forums > Unix > Unix/perl file list retrieval

Unix/perl file list retrieval

Reply to Message Icon

Original Message
Name: delory
Date: March 3, 2004 at 10:00:23 Pacific
Subject: Unix/perl file list retrieval
OS: Winnt
CPU/Ram: 400 256
Comment:

I am trying to retrieve a list of directories which have received new files, step through the list and ls for each row to produce a complete list. Works fine, except I nave had to add in functionality to uncompress and untar files before listing them. So far I have:

find $direc -type f -newer $logs/laststamp -depth -exec dirname {} \; | grep -vE "dev|e2e" | sort -u > $logs/recentfiles

#1
cat $logs/recentfiles | while read line
do
code='BEGIN{}

if ( /\.Z$/ ){
system("uncompress $line/$_");
s/\.Z$//;
}
if ( /\.tar$/ ){
system("tar -xvf $_");
}

END{}
'

ls -lt $line|grep -v total|cut -c58-|grep -E "\.Z$|\.tar$" >> $logs/filelist
perl -s -line=$line -ne "$code" $logs/filelist
cp $logs/filelist $logs/filelist.spare
cat /dev/null > $logs/filelist
done

but it's not working, giving me an error message about not being able to rename filelist directory. I think the perl might be slightly off, but can't see why. Any help appreciated.


Report Offensive Message For Removal


Response Number 1
Name: Dlonra
Date: March 3, 2004 at 14:00:35 Pacific
Subject: Unix/perl file list retrieval
Reply: (edit)

i assume this is not linux where tar has -N option?


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Unix/perl  file list retrieval

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge