CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Working down directories

 



Andy101
New User

Jul 10, 2009, 4:46 AM

Post #1 of 2 (349 views)
Working down directories Can't Post

I managed to get my script working for the current directory, but would like to have the script going down into other directories.

It is to replace a string in text files, but the names of these files can be anything.

I would like to exclude binary (all non text files, if possible).


Code
   

perl -pi -e 's/OldStr/NewStr/g' *



Thanks,



Andy.


shawnhcorey
Enthusiast


Jul 10, 2009, 5:12 AM

Post #2 of 2 (348 views)
Re: [Andy101] Working down directories [In reply to] Can't Post


In Reply To
I managed to get my script working for the current directory, but would like to have the script going down into other directories.


Use File::Find to search through sub-directories. See `File::Find` for details.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives