Problem using find on win32

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to find the following file ( where version number can vary)
org.eclipse.equinox.lanucher_x.x.x.jar in "C:\Tools\SDS\plugins\"

sub equinox (){
 $jar = $File::Find::name if /\Aorg\.eclipse\.equinox\.launcher_.*\.jar\z/;

my $equinoxDir = "C:\Tools\SDS\plugins\

find (\&equinox,$equinoxDir);

I can see that the path for files & directories found using find becomes:


and so on.

So the full path becomes:


which does not work.

How can make paths be the same.

Mikael Petterson
Software Designer
Ericsson AB, Stockholm, Sweden
Visiting address: Isafjordsgatan 15, Kista
Phone: +46 70 2673044  

Re: Problem using find on win32

Quoted text here. Click to load it

I would recommend to use forward slashes (/) instead of back slashes
(\) wherever possible.

my $equinoxDir = "C:/Tools/SDS/plugins/";

It's easier on the eyes (avoids "\", "leaning toothpicks") and it
works even on Windows (unless you shell out to the command line prompt
with system(), in which case you are forced to use back slashes)

Quoted text here. Click to load it

I observe: File::find has returned forward slashes.

Quoted text here. Click to load it

You have a mix of forward and backward slashes, which might be the
reason for your problem.

If you use forward slashes to start with, your full path will be:
$fullpath = "C:/Tools/SDS/plugins//mydir";

Notice that there is only one type of slash (forward slash).
The double forward slash between "plugins" and "mydir" gets
automatically resolved into a single slash, no need to resolve that,
really. This should work perfectly, even on Windows.

However, should you wish to resolve it for other reasons, or just
because it looks better, then you could use:

$fullpath =~ sg;


Site Timeline