The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Getting unusual error - moving files to another directory aismann Shell Programming and Scripting 4 12-20-2007 11:29 PM
Opening Files in append mode vidhya UNIX for Dummies Questions & Answers 1 03-27-2006 01:46 PM
opening non-html files in lynx?? riwa UNIX for Dummies Questions & Answers 0 03-04-2006 01:07 PM
Opening files saarshad001 UNIX for Dummies Questions & Answers 3 11-28-2003 08:42 AM
Opening Files AJA UNIX for Dummies Questions & Answers 4 11-10-2003 07:25 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 19
Stumble this Post!
error while opening files in a directory

I tried opening the files in a directory and print thier names.
But it was thowing the error "unable to open directorty at t5.pl line 2."
Can u plz correct this error in below mentioned code.


#!/data/scoredev/perl
opendir(HOMEDIR,"c:\vin") || die("unable to open directorty");
@files=readdir(HOMEDIR);
closedir(HOMEDIR);

foreach $file (sort @files) {
print ("$file\n");
}

unable to open directorty at t5.pl line 2.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Location: Scotland
Posts: 102
Stumble this Post!
Get more information about why you cannot open the directory with
Code:
opendir(HOMEDIR,"c:\vin") || die("unable to open directory: $!");
Reply With Quote
  #3 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 19
Stumble this Post!
Quote:
Originally Posted by spirtle View Post
Get more information about why you cannot open the directory with
Code:
opendir(HOMEDIR,"c:\vin") || die("unable to open directory: $!");
How can I open the directory which is in windows in unix perl script.
Reply With Quote
  #4 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Location: Scotland
Posts: 102
Stumble this Post!
I think that you use Unix-style directory separators in Perl -- try
Code:
opendir(HOMEDIR,"c:/vin")
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0