Re: using Perl, How to search for files in my computer

2011-06-12 Thread Brian F. Yulga
shawn wilson wrote: On Sun, Jun 12, 2011 at 14:38, Brian F. Yulga wrote: perl -MFile::Find -wle "find( sub{ /\.mp3$/i and print;}, q(.));" just curious, what's the difference (in speed or results) between this and 'dis/a/s/b *.mp3'? obviously File::Find and perl are more powerful,

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Brian Fraser
use File::Find::Rule; my @mp3_files = File::Find::Rule->file->name(qr/ \. mp3$ /x)->in("C:/"); Tada. The problem with this (and all previous) solutions is that, if you have filenames with non-English (bah, ascii/latin-1) characters, you'll get a bunch of garbage instead. I'm not aware if there's

Re: using Perl, How to search for files in my computer

2011-06-12 Thread shawn wilson
On Sun, Jun 12, 2011 at 14:38, Brian F. Yulga wrote: > > Hi Sayth, et. al., > > At work I'm stuck on Winblows, and this is one of the ways Strawberry Perl > (portable install) saves me lots of time.  There's nothing wrong with the > other solutions presented; I'm just adding to the variety...  I u

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Brian F. Yulga
Sayth Renshaw wrote: Try: my @Music_files = (); use File::Find; find( \&want_mp3, 'd:\\' ); print "$_\n" for sort @Music_files; sub want_mp3 { push @Music_files, $File::Find::name if $_ =~ /\.mp3$/; } -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of unde

Re: using Perl, How to search for files in my computer

2011-06-12 Thread John Delacour
At 03:40 -0700 12/06/2011, eventual wrote: I've read perldoc File::Find but I dont understand. So If I wish to search for "mp3" in d:\ and all its sub-directories, and to print it out if found, How should I write? Just put the directory in $dir: #!/usr/local/bin/perl use strict; use File::

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Sayth Renshaw
> Try: > > my @Music_files = (); > > use File::Find; > find( \&want_mp3, 'd:\\' ); > print "$_\n" for sort @Music_files; > > sub want_mp3 { >  push @Music_files, $File::Find::name if $_ =~ /\.mp3$/; > } > > > -- > Just my 0.0002 million dollars worth, >  Shawn > > Confusion is the first step of

Re: using Perl, How to search for files in my computer

2011-06-12 Thread shawn wilson
On Jun 11, 2011 11:15 AM, "eventual" wrote: > > Hi, > I am using windows7. > Using Perl, how do I search for files in my computer, eg to search in c:\ and all its sub-directories. > I only know how to use glob to search from a particular location. > Thanks I haven't seen any mention of find2perl

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Shawn H Corey
On 11-06-12 06:40 AM, eventual wrote: I've read perldoc File::Find but I dont understand. So If I wish to search for "mp3" in d:\ and all its sub-directories, and to print it out if found, How should I write? Try: my @Music_files = (); use File::Find; find( \&want_mp3, 'd:\\' ); print "$_\n"

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Sayth Renshaw
Actually got it working. You would need to use File::Find to search sub directories however. #!\usr\bin\perl use warnings; use strict; use diagnostics; use File::List; my $mp3; my @musiFiles; $mp3 = new File::List("C:/Users/RenshawFamily/maven/Music/Foo Fighters"); my @musicFiles = @{ $mp3->find(

Re: using Perl, How to search for files in my computer

2011-06-12 Thread Sayth Renshaw
> From: Shawn H Corey > To: beginners@perl.org > Sent: Saturday, June 11, 2011 11:31 PM > Subject: Re: using Perl, How to search for files in my computer > > On 11-06-11 11:14 AM, eventual wrote: >> Hi, >> I am using windows7. >> Using Perl, how do I search for file

Re: using Perl, How to search for files in my computer

2011-06-12 Thread eventual
Re: using Perl, How to search for files in my computer On 11-06-11 11:14 AM, eventual wrote: > Hi, > I am using windows7. > Using Perl, how do I search for files in my computer, eg to search in c:\ and > all its sub-directories. > I only know how to use glob to search from a particul

Re: using Perl, How to search for files in my computer

2011-06-11 Thread Shawn H Corey
On 11-06-11 11:14 AM, eventual wrote: Hi, I am using windows7. Using Perl, how do I search for files in my computer, eg to search in c:\ and all its sub-directories. I only know how to use glob to search from a particular location. Thanks You can use File::Find, see `perldoc File::Find`. It i