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-21-2007 12:29 AM
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 02:07 PM
Opening files saarshad001 UNIX for Dummies Questions & Answers 3 11-28-2003 09:42 AM
Opening Files AJA UNIX for Dummies Questions & Answers 4 11-10-2003 08:25 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 19
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  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Location: Scotland
Posts: 121
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  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 19
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  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Location: Scotland
Posts: 121
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 Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:24 PM.


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

Content Relevant URLs by vBSEO 3.2.0