Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: file case change

by ChOas (Curate)
on Mar 15, 2002 at 12:26 UTC ( #151966=note: print w/replies, xml ) Need Help??


in reply to Re: file case change
in thread file case change

Okay:
change
for (readdir DIR) { print "$_<br>"; rename("$path/$_", lc("$path/$_")) or print "Couldn't rename $file +: $!\n"; }
to:
for (readdir DIR) { next if (/^\.{1,2}$/); print "$_<br>"; rename("$path/$_", lc("$path/$_")) or print "Couldn't rename $_: $ +!\n"; }

GreetZ!,
    ChOas

print "profeth still\n" if /bird|devil/;

Replies are listed 'Best First'.
Re: Re: Re: file case change
by tachyon (Chancellor) on Mar 15, 2002 at 20:34 UTC

    This is really bad code. First you lowercase the whole file path ensuring that any uppercase path will break this code (as when you lowercase it you will then try to write along a non existant path). Next you seem to have forgotten that '.' and '..' are not the only directories you might find. Finally you should never print unescaped arbitrary strings in HTML.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://151966]
help
Chatterbox?
[holli]: so i filed a pull request for a open source project on github, they guy asks me "what motivates me to do this"
[holli]: i am tempted to answer "to please our new asian overlords" or something
[holli]: what a silly question

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-10-18 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (251 votes). Check out past polls.

    Notices?