On 30/6/99 at 11:30 AM, dennis.j.little@lmco.com (Dennis Little) wrote: > >Dear sir, > > > >Please could you advise me as a newcomer to Perl. I am trying to gather > >documents from a variety of directories, some deeply nested. Once I have > >the files I then propose to copy them somewhere else and maybe export > >the data into filemaker or something like that. I realise that it may be > >achievable by applescript but so far, I have not enjoyed using this > >method! > > > >Could you point me out to some sample perl code that might help? I would > >expect that I need a subroutine or function that will be called if a > >certain file is a directory. I understand how to do a basic list for one > >level but am stuck as to how to go say 5 levels deep. > > > >Many thanks for your assistance. > > > > > >Mark Bedish > > Mark, > > I've included a routine that should help you get started. It's probably a > long way from the most perfect system but it works well. > > To run it, open it in Perl and save it as a droplet. Then take a directory > you want to parse and drop it on it. > > What it does: > > Given the passed directory, traverse through and create 4 files (list of > aliases, list of files (full path), list of directories, and a list of > errors). > > Warning -- For obvious reasons, don't drop your hard drive on it since it > will take a LONG time to complete all the recursing (assuming it doesn't > die). > > > ----- > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Dennis Little mailto://dennis.j.little@lmco.com > Lockheed Martin Missiles & Space mailto://metnet@worldnet.att.net > Sunnyvale, CA Web: http://www.lmms.lmco.com/ > Phone: 408/756-2170 LMMS: O/EA52 B/076 C/3E8 > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dennis, Thanks for the code. I managed to get it working OK except that I could only stop 'Icon' files from coming out by checking the filename : if (((-M "$file") < $age) and (index("$file",'Icon') < 0)) { $file_cnt = $file_cnt + 1; ($a,$b) = MacPerl::GetFileInfo($full_file_path); #print("$file" . "," . "$a" . "," . "$b\n"); printf FILELIST ("$full_file_path ,$file, %d\n" , (-M $full_file_path")) } I am looking at the following improvements : 1. Write the output instead of printing so I can import into Filemaker (although Print does work If I use csv) 2. Is there a simple GREP facility to pick out for example HTML docs etc? I dont follow how to use grep to pick up tags yet! 3. Getting more information from files e.g. size, date created .... 4. Finally, I would like to reformat text files to a certain width, a sort of hard wrap. I could use these for my Newton! Thanks again. Regards Mark Bedish ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org