Solved

directory handling on NT

Posted on 1998-10-01
8
142 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
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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP equivalent of opening a com object 5 69
Any syntax error for this clone.plscript 6 132
How to generate square thumbnail using perl 13 77
Perl tar error 8 49
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 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

19 Experts available now in Live!

Get 1:1 Help Now