RE: How to find same filename in subdirectory

From: Lktee (lktee_at_bantex.com.my)
Date: 05/26/04


To: 'Jan Eden' <lists@janeden.org>
Date: Wed, 26 May 2004 17:24:08 +0800

Hi, now I design another way.

First I request user enter the directory want to search first, if the
directory exist in the system, script will search the entire directory. If
the filename is same will display out, else no result will return. If
directory not exist will request user try another directory.

So, the script like below:

#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
find ( \&callback, "/$target");

my $target;
while (1) {
        print "what directory want search?";
        $target = <STDIN>
        chmod $target;
        if (-d $target) {
                print "Yes, target is a directory.\n";
                next;
        }
        else{
                print "No, $target not a directory.\n";
        
        sub callback{
                print $File::Find::name, "\n" if $File::Find::name =~
/File1$/;
}

May I know any wrong in my coding? Because I cannot run the script. Any idea
about this?



Relevant Pages

  • Re: using xml to save/open project data
    ... http://www.TransProCalc.org - Free translation project mgmt software ... set filename tk_getOpenfile ... Exec'ing the script you run it as a separate process, your script won't be able to access its vars. ... generating the xml file is easy enough. ...
    (comp.lang.tcl)
  • Re: Help me find 5 mistakes and than solution to thoes mistakes!
    ... > 8:# This script will create links to files from all of the filename ... > 10:# arguments provided on stdin if no filenames provided on command ...
    (Fedora)
  • Re: MIME - scripting and symbol substitutions
    ... This script is creating a text file with a different filename ... symbol called NEWFILENAME (which works, ... MIME from the command line with all options (so normal DCL ...
    (comp.os.vms)
  • Re: virtual server backups
    ... Here is the script. ... 'Save state the virtual machine ... Filename = MyArray) ... Set objVM = Nothing ...
    (microsoft.public.windows.server.general)
  • Help with os.spawnv
    ... I've had to migrate back to Python 2.1 and am now trying to use ... This script gets each Ascii file in the workspace, ... for filename in filenames ...
    (comp.lang.python)