PERL: testing directory on windows platform


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PERL: testing directory on windows platform
# 1  
Old 04-03-2012
PERL: testing directory on windows platform

Hi Gurus, kindly analyse the following for me, please
Code:
OS: Windows 7
Code location: C:\
Output: "Program Files not being recognised"
           "System Volume Information is a directory"
           "Windows not being recognised"

Code:
main {
	my @dirlist = <*>;
	foreach my $fn (@dirlist)	{
		if( -f $fn)	{
			print("$fn is a file\n");
		}
		elsif(-d $fn){
			message("$fn is a directory\n");
		}
		else{
			message("$fn not being recognised\n");
		}
	}
}


Obviously "Program Files" and "Windows" are plain folders in Windows platform.

Here is the ls -ltra

Code:
drwxrwxrwx   1 NT+SERVICE\TrustedInstaller NT+SERVICE\TrustedInstaller       0 Apr  2 23:01 Program Files
drwhrwsrwx   1 Administrators  SYSTEM                0 Nov  3 00:42 System Volume Information
drwxrwxrwx   1 NT+SERVICE\TrustedInstaller NT+SERVICE\TrustedInstaller       0 Apr  3 18:36 Windows

The only difference between folder "System Volume Information" and "Windows" or "Program Files" is the owner, "Administrators" versas "NT+SERVICE\TrustedInstaller"

Is that the reason that caused the 2 folders "Program Files" and "Windows" not being recognised? Why?

Thank you.

Last edited by Franklin52; 04-04-2012 at 03:21 AM.. Reason: Please use code tags for code and data samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell scripting on Windows platform

Is there a free unix platform that will allow me to write a shell script on my Windows OS? I have my files on my C: drive and i need to write a script that reads from those files and does some manipulation. Its pretty straightforward in unix commands hence i don't want to write a Java/C++ program... (3 Replies)
Discussion started by: jakSun8
3 Replies

2. UNIX for Dummies Questions & Answers

Need help configuring Active Perl on Windows Vista.: Perl Scripting on Windows

Hi All, Need help configuring Active Perl on Windows Vista. I am trying to install Active Perl on Windows Vista. The version of Active Perl i am trying to install is : ActivePerl 5.10.1 Build 1006 After installing it through cmd, When i try to run perl -v to check the version, i get the... (2 Replies)
Discussion started by: Vabiosis
2 Replies

3. UNIX for Dummies Questions & Answers

FTP from Windows XP platform to HP-UNIX10.20 machine apllications

Hi Friends Pl. clarify the following. 1. By using ftp hostname we can connect each other as long as within the n/w. Provided user name and password. 2. Using mget****(required files with extension) can trasnsfer all the files(text as well as graphical formats). 3. How we can reproduce the... (2 Replies)
Discussion started by: mohamedfaizyka
2 Replies

4. AIX

how to allow Windows platform to access Unix based disk volumes

How to allow Windows platform to access Unix(AIX) based disk volumes? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

5. Shell Programming and Scripting

How to change a directory on windows via perl script

How to change a directory on windows via perl script. I wanna mount a share on windows via perl script. I have used:- system("dir"); gives the list of directories in the drive i am.This command works well. Now i want to move from c drive to z drive via perl script.I am using:- ... (2 Replies)
Discussion started by: TRUPTI
2 Replies

6. UNIX for Dummies Questions & Answers

Exporting Files from Unix to a Windows Platform

I was able to convert my csv file in Unix to xls. I would like to export the converted xls file to a windows environment. I have to manually connect using the following below: ftp: 192.x.x.x -> username/pass -> cd -> mget *.xls and then confirm. Could I automate this process into a shell... (4 Replies)
Discussion started by: ravzter
4 Replies

7. Windows & DOS: Issues & Discussions

checking the size of unix cd on windows platform

Hi, Is it possible or is there a program out there that can get the byte size of a unix cd on the windows platform. Any help would be really great with this. Thanks (2 Replies)
Discussion started by: johnjsm
2 Replies
Login or Register to Ask a Question