my @allfiles=sort(grep(!/^\.\.?$/, readdir DIR)); 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Ramkumar
Sent: 09 July 2009 08:45
To: [email protected]
Subject: Read file names as per Windows file listing order

Hi All,

In windows explorer, files in a folder displaying (name sort) as,
Chapter 1.doc Chapter 2.doc Chapter 3.doc Chapter 4.doc Chapter 12.doc
Chapter 20.doc Chapter 21.doc Chapter 30.doc Chapter 31.doc Chapter
40.doc Chapter 41.doc Chapter 42.doc

I need the above list/result using Perl. But Perl gives result as below,
Chapter 1.doc Chapter 12.doc Chapter 2.doc Chapter 20.doc Chapter 21.doc
Chapter 3.doc Chapter 30.doc Chapter 31.doc Chapter 4.doc Chapter 40.doc
Chapter 41.doc Chapter 42.doc

I have tried (3 different ways) the below code:

(1) opendir(DIR, $folderpath) || die "Error in opening dir $dirname\n";
        while(($filename = readdir(DIR)))
        {print("$filename\n");}
    closedir(DIR);
(2) @xmlfiles =
File::Find::Rule->file()->name('*.doc')->in($folderpath);
(3) system("dir/b >\"$folderpath\\TextFiles.txt\"");

Please suggest if you have any idea to achive my requirement in perl.

Regards,
Ramkumar,


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


**********************************************************************
Private, Confidential and Privileged. This e-mail and any files and attachments 
transmitted with it are confidential and/or privileged. They are intended 
solely for the use of the intended recipient. The content of this e-mail and 
any file or attachment transmitted with it may have been changed or altered 
without the consent of the author. If you are not the intended recipient, 
please note that any review, dissemination, disclosure, alteration, printing, 
circulation or transmission of this e-mail and/or any file or attachment 
transmitted with it, is prohibited and may be unlawful. If you have received 
this e-mail or any file or attachment transmitted with it in error please 
notify Anglo Irish Bank Corporation Limited, Stephen Court, 18/21 St Stephen's 
Green, Dublin 2, Ireland, telephone no: +353-1-6162000. 
Directors: D O'Connor (Chairman), F Daly, A Dukes, M Keane, D Quilligan.
Registered Office: Stephen Court, 18/21 St Stephen's Green, Dublin 2 Ireland
Registered in Ireland: No 22045
Anglo Irish Bank Corporation Limited is regulated by the Financial Regulator. 
Anglo Irish Bank Corporation Limited (trading as Anglo Irish Bank Private 
Banking) is regulated by the Financial Regulator. Anglo Irish Assurance Company 
Limited is regulated by the Financial Regulator. 
**********************************************************************

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to