Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > A string manipulation question

Reply
Thread Tools

A string manipulation question

 
 
John Yoo
Guest
Posts: n/a
 
      04-11-2006
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

 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      04-11-2006
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


 
Reply With Quote
 
 
 
 
Dr.Ruud
Guest
Posts: n/a
 
      04-11-2006
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."

 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      04-11-2006
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."

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String Manipulation Question - Can RegEx Do This? Franklin ASP .Net 5 02-28-2009 10:09 PM
python challenge question (string manipulation) John Salerno Python 8 03-30-2006 07:33 PM
String Manipulation Question from a Newbie! Morris.C C++ 4 09-08-2005 08:22 AM
String Manipulation Nuby Question Chris Roos Ruby 12 05-06-2005 02:36 AM
Perl string manipulation jared in ecs Perl 2 10-22-2003 05:36 PM



Advertisments
 



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