?
Solved

directory handling on NT

Posted on 1998-10-01
8
Medium Priority
?
149 Views
Last Modified: 2010-03-05
2 questions:
first, how do you determine the existance of a named directory on NT?  -e $fn doesn't work.
second, can mkdir() or another method be used to create a directory other than in the current one (like a\b\c for example)?
0
Comment
Question by:glow060197
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 5

Expert Comment

by:b2pi
ID: 1205069
I don't believe either of these is NT specific

-d will tell you if a directory exists, or if a file is a directory
(note that even on unix, -f $dir will return false if $dir is a
directory).

mkdir(/this/is/an/odd/path) will work if /this/is/an/odd is a
directory, or, you can use

use File::Path;
mkpath('/this/is/an/odd/path',0,777);

which will make whatever part of the path needs to be made.


0
 

Author Comment

by:glow060197
ID: 1205070
actually on NT to get directory entry attributes (e.g. file ? directory? hidden? ...) you must use Win32::File::getAttributes()  or something similar (i'm away from my notes..) but that doesn't allow for checking *existence* which is what i'm looking for.  you're halfway there..i'll give you the points if you get this.  thanks.  

what i don't understand is why they couldn't have made the -x type commands work on NT if you can do it anyways.  is the Win32 library ("module") somehow "non-standard", or what?
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1205071
Have you actually TRIED using -d?  Or are you using ActiveWare?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:glow060197
ID: 1205072
actually I am using ActiveWare...I don't know any better to use.
I actually tried using -f and -d though.  what perl should i obtain?  does gnu have one for Windows?
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1205073
Yup.  If you download the standard distribution, it compiles fine, and
(I believe) standard file operators work.
0
 

Author Comment

by:glow060197
ID: 1205074
alright.  if you want the points, though you need to submit another 'answer'.  
thanks a lot.
0
 
LVL 5

Accepted Solution

by:
b2pi earned 300 total points
ID: 1205075
You are sure that the code

if (-f '/temp') {
   print "How did I get here?\n";
} else {
   print "Yup, -f returns 0 on directories\n";
}

if (-d '/temp') {
    print "Yup, -d does work\n";
} else {
    print "Oh, no, Mr. Bill!!!\n";
}



doesn't do what it should on active ware?
0
 

Author Comment

by:glow060197
ID: 1205076
those commands didn't seem to work, no.  but i'll try your code tomorrow and see how it does.

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question