![]() |
A string manipulation question
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 |
Re: A string manipulation question
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 |
Re: A string manipulation question
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/Win...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." |
Re: A string manipulation question
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/Win...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." |
| All times are GMT. The time now is 01:56 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.