Solved

directory handling on NT

Posted on 1998-10-01
8
140 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
  • 4
  • 4
8 Comments
 
LVL 5

Expert Comment

by:b2pi
Comment Utility
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
Comment Utility
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
Comment Utility
Have you actually TRIED using -d?  Or are you using ActiveWare?
0
 

Author Comment

by:glow060197
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

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

Author Comment

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

Accepted Solution

by:
b2pi earned 100 total points
Comment Utility
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
Comment Utility
those commands didn't seem to work, no.  but i'll try your code tomorrow and see how it does.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now