Perlwannabe wrote:
> 
> Here is my problem.  I want to delete the files contained in a directory
> from a list contained in a file.  Here is an example:
> 
> The input file is a regular text file in the following format (call it
> myfile.txt);
> 
> item1
> item2
> item3
> item4
> ....
> 
> What I want to do is look in a directory and delete any file in the
> directory that contains any item on the list.  For example, lets say the
> contents of the directory looks like this:
> 
> 07/24/2003  01:27 AM             3,812 heresanitem1
> 07/24/2003  10:42 PM           912,126 heretoitem2
> 07/14/2003  12:19 AM               234 item3ishere
> 06/12/2003  10:25 PM            34,049 leavemealone
> 06/12/2003  10:25 PM            16,683 leavemealonetoo
> 07/22/2003  11:36 PM             1,825 yupitem4yup
> ....
> 
> I would like to read each line of the file from "myfile.txt" [getline() I
> suppose] and then delete the files that have ANY MATCHING information from
> the input file.  So if the input file has "item1" it will delete the file
> "heresanitem1" as well as "alsoitem1aswell" from the directory.  So when I
> run the script the sample directory above will look like this:
> 
> 06/12/2003  10:25 PM            34,049 leavemealone
> 06/12/2003  10:25 PM            16,683 leavemealonetoo
> ....
> 
> This problem has been tough for me.  I have read everything I can get my
> hands on concerning unlink but I cannot get this problem solved.  Any help
> appreciated.

Were the answers you received in comp.lang.perl.misc no good enough?

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=mbudash-8EC90B.23563424072003%40typhoon.sonic.net&rnum=1&prev=/groups%3Fas_q%3Ditem1%2Bitem2%2Bitem3%2Bitem4%26num%3D10%26as_scoring%3Dd%26hl%3Den%26ie%3DISO-8859-1%26btnG%3DGoogle%2BSearch%26as_epq%3D%26as_oq%3D%26as_eq%3D%26as_ugroup%3Dcomp.lang.perl.misc%26as_usubject%3D%26as_uauthors%3D%26as_umsgid%3D%26lr%3D%26as_drrb%3Dq%26as_qdr%3D%26as_mind%3D12%26as_minm%3D5%26as_miny%3D1981%26as_maxd%3D25%26as_maxm%3D7%26as_maxy%3D2003%26safe%3Dimages


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to