Professional Web Applications Themes

How to find files in subdirectory - PERL Beginners

Hi, I'm perls beginner now, I have a problem when create a script find all file in subdirectory that have the same filename. How I write the script using perl and return the result like below: File1: ~/A/File ~/A/AA/file1 ~/A/C/CC/CCC/file Kuan....

  1. #1

    Default How to find files in subdirectory

    Hi, I'm perls beginner now, I have a problem when create a script find all
    file in subdirectory that have the same filename. How I write the script
    using perl and return the result like below:



    File1: ~/A/File ~/A/AA/file1 ~/A/C/CC/CCC/file



    Kuan.


    Lk Guest

  2. #2

    Default RE: How to find files in subdirectory


    Check the doentation for the File::Find module. It comes standard
    with most Perl distributions.

    -----Original Message-----
    From: LK Tee [mailto:com.my]
    Sent: Wednesday, May 12, 2004 6:52 PM
    To: 'org'
    Subject: How to find files in subdirectory

    Hi, I'm perls beginner now, I have a problem when create a script find
    all file in subdirectory that have the same filename. How I write the
    script using perl and return the result like below:



    File1: ~/A/File ~/A/AA/file1 ~/A/C/CC/CCC/file



    Kuan.


    Tim Guest

  3. #3

    Default RE: How to find files in subdirectory

    Hi, after refer the File::Find, I write the script below:

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

    sub callback{
    print $File::Find::name, "\n";
    }

    but this script will list all the filename, from the disk. So, how I set the
    condition, only display the same filename in the same directory? Anybody can
    give me the solution? And your solution will appreciate.




    -----Original Message-----
    From: Tim Johnson [mailto:com]
    Sent: Thursday, May 13, 2004 11:21 AM
    To: LK Tee; org
    Subject: RE: How to find files in subdirectory


    Check the doentation for the File::Find module. It comes standard
    with most Perl distributions.

    -----Original Message-----
    From: LK Tee [mailto:com.my]
    Sent: Wednesday, May 12, 2004 6:52 PM
    To: 'org'
    Subject: How to find files in subdirectory

    Hi, I'm perls beginner now, I have a problem when create a script find
    all file in subdirectory that have the same filename. How I write the
    script using perl and return the result like below:



    File1: ~/A/File1 ~/A/AA/File1 ~/A/C/CC/CCC/File1



    Kuan.


    Lktee Guest

  4. #4

    Default RE: How to find files in subdirectory

    LKTee wrote on 25.05.2004:
     

    print $File::Find::name, "\n" if $File::Find::name =~ /File1$/;

    HTH,

    Jan
    --
    Common sense is what tells you that the world is flat.
    Jan Guest

Similar Threads

  1. Create a subdirectory and change to subdirectory
    By Jay_Shakir@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: October 10th, 02:57 AM
  2. storing custom class files in a subdirectory
    By leebock in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: June 29th, 03:55 PM
  3. How do I set a hyperlink to a subdirectory
    By Eva White via .NET 247 in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: August 4th, 06:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139