A string manipulation question

Discussion in 'Perl Misc' started by John Yoo, Apr 11, 2006.

  1. John Yoo

    John Yoo Guest

    Hi, I am new to PERL and have a string manipulation question.

    I found a DOS command program called xxmklink that creates shortcuts
    for a given file. The syntax is: xxmklink "path of the shortcut name"
    "path of the object file name"

    I would like to find all the .bat files in its directory and all
    subdirectories. Then capture all the characters from the last "\" to
    ".bat" for the shortcut name. For example, the command finds
    "C:\some_dir\another_dir\a_filename.bat, then the shortcut name is
    a_filename. What command(s) should I use? How is this written? Is
    this possible?

    [note: I am using AcitvePerl for Windows.]

    Any advice will be greatly appreciated.

    Thanks!
    John
     
    John Yoo, Apr 11, 2006
    #1
    1. Advertising

  2. John Yoo wrote:
    > Hi, I am new to PERL and have a string manipulation question.


    The programing language is called Perl, the interpreter is called perl.
    There is no PERL.
    For further details see "perldoc -q difference":
    What's the difference between "perl" and "Perl"?

    > I would like to find all the .bat files in its directory and all
    > subdirectories. Then capture all the characters from the last "\" to


    The File::Find module is your friend, see "perldoc File::Find"

    > ".bat" for the shortcut name. For example, the command finds
    > "C:\some_dir\another_dir\a_filename.bat, then the shortcut name is
    > a_filename. What command(s) should I use? How is this written? Is
    > this possible?


    The File::Basenaem module is your friend, see "perldoc File::Basename"

    jue
     
    Jürgen Exner, Apr 11, 2006
    #2
    1. Advertising

  3. John Yoo

    Dr.Ruud Guest

    John Yoo schreef:

    > I found a DOS command program called xxmklink that creates shortcuts
    > for a given file. The syntax is: xxmklink "path of the shortcut name"
    > "path of the object file name"


    On NTFS there are also hardlinks and softlinks, see Win32::Hardlink and
    Win32::Symlink.
    http://search.cpan.org/~autrijus/Win32-Hardlink-0.02/Hardlink.pm


    > I would like to find all the .bat files in its directory and all
    > subdirectories. Then capture all the characters from the last "\" to
    > ".bat" for the shortcut name. For example, the command finds
    > "C:\some_dir\another_dir\a_filename.bat, then the shortcut name is
    > a_filename. What command(s) should I use? How is this written? Is
    > this possible?



    For less surprises, always use the forward slash '/'.

    Check out http://search.cpan.org/~ingy/IO-All-0.33/lib/IO/All.pod for
    all traversing and manipulating your filesystem.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Apr 11, 2006
    #3
  4. John Yoo

    Dr.Ruud Guest

    Dr.Ruud schreef:
    > John Yoo:


    >> I found a DOS command program called xxmklink that creates shortcuts
    >> for a given file. The syntax is: xxmklink "path of the shortcut
    >> name" "path of the object file name"

    >
    > On NTFS there are also hardlinks and softlinks, see Win32::Hardlink
    > and Win32::Symlink.
    > http://search.cpan.org/~autrijus/Win32-Hardlink-0.02/Hardlink.pm


    Ignore that for this case; shortcuts are indeed more appropriate,
    because you have more control, by its properties.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Apr 11, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jared in ecs

    Perl string manipulation

    jared in ecs, Oct 22, 2003, in forum: Perl
    Replies:
    2
    Views:
    824
    Roy Johnson
    Oct 22, 2003
  2. John Salerno
    Replies:
    8
    Views:
    6,309
    Caleb Hattingh
    Mar 30, 2006
  3. Morris.C
    Replies:
    4
    Views:
    382
    Maxim Yegorushkin
    Sep 8, 2005
  4. Franklin
    Replies:
    5
    Views:
    364
    Franklin
    Feb 28, 2009
  5. Chris Roos

    String Manipulation Nuby Question

    Chris Roos, May 6, 2005, in forum: Ruby
    Replies:
    12
    Views:
    219
    James Britt
    May 6, 2005
Loading...

Share This Page