error while opening files in a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting error while opening files in a directory
# 1  
Old 06-12-2008
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.
# 2  
Old 06-12-2008
Get more information about why you cannot open the directory with
Code:
opendir(HOMEDIR,"c:\vin") || die("unable to open directory: $!");

# 3  
Old 06-12-2008
Quote:
Originally Posted by spirtle
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.
# 4  
Old 06-12-2008
I think that you use Unix-style directory separators in Perl -- try
Code:
opendir(HOMEDIR,"c:/vin")

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

resize2fs open: Is a directory while opening /home

Can anyone explain this error to me? I am trying to use resize2fs to resize an ext4 partition. I did unmount the partition and I don't have any files opened or anything like that. Here is the full output. # resize2fs -p /home 3G resize2fs 1.41.12 (17-May-2010) open: Is a directory while... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Programming

help with opening files and reading them in C

In C, given a name or path to a file, how do I check if the path is valid, and how can I check its permisions will let me read from it, and how do i check if its an empty file? (15 Replies)
Discussion started by: omega666
15 Replies

3. Windows & DOS: Issues & Discussions

Error opening script file - location error

Hello, I know nothing about UNIX, ftp, etc. I am building an excel VBA macro which calls a .bat file. I've taken a pre-existing batch file and am trying to modify it to fit my purposes. I would be very grateful for some assistance. Here is my .bat file: echo off set... (9 Replies)
Discussion started by: starcraftbud
9 Replies

4. UNIX for Dummies Questions & Answers

How to find files with ERROR's in log directory

Using a Single Unix Command how can i find all of the files ending in .log in the /output directory tree that have the string “ERROR:” in the file I tried these but was not successful: cd /output; ls *.log | grep "ERROR:" (2 Replies)
Discussion started by: ramky79
2 Replies

5. Web Development

opening text files with javascript

Im aware under IE, javascript uses ActiveX Objects to open up and manipulate text files, excel files etc.. How abouts would I open a text file using javascript in Firefox ? thanks (1 Reply)
Discussion started by: JamesGoh
1 Replies

6. Shell Programming and Scripting

Getting unusual error - moving files to another directory

Dear experts, Im having an unusual problem and its been giving me a bad headache. I have the script below #!/usr/bin/sh -x ticketinputdir=/IN_DATA1/tickets ticketoutputdir=/IN_DATA2 YDAY=`env TZ=A12B date '+%Y%m%d'` for i in INA INB INC IND INE do mkdir $ticketoutputdir/$i/$YDAY... (4 Replies)
Discussion started by: aismann
4 Replies

7. UNIX for Dummies Questions & Answers

Opening Files in append mode

Is there any other way to open a file in append mode without using C calls or >> redirection? (1 Reply)
Discussion started by: vidhya
1 Replies

8. UNIX for Dummies Questions & Answers

opening non-html files in lynx??

when i try to open a txt file in lynx I need to provide the filename or use wildcards to open. Autocompletion doesn't work for some reason. Also, trying to open files like: .sh, .py etc. ends up in the following error: lynx: Start file could not be found or is not text/html or text/plain ... (0 Replies)
Discussion started by: riwa
0 Replies

9. UNIX for Dummies Questions & Answers

Opening files

I am very new to unix. I want to open a file and read one line in at a time. Can anybody help? (3 Replies)
Discussion started by: saarshad001
3 Replies

10. UNIX for Dummies Questions & Answers

Opening Files

I'm a new to UNIX/LINUX. I just put cygwin on my laptop and I can navigate around the directories, but I can't open files (.doc, .ppt, .html or .exe). Is there an explicit command to do this? I know that in Solaris when it does not recognize the file, it brings up the list of available viewing... (4 Replies)
Discussion started by: AJA
4 Replies
Login or Register to Ask a Question