[Cascavel-pm] apagando arquivos

Igor Sutton Lopes igor.sutton em gmail.com
Quarta Maio 30 15:57:43 PDT 2007


On May 30, 2007, at 5:24 PM, Thomas Britis wrote:

> Duas formas.
>
> 1- (feia, q nem a sua, hehe):
> #!/usr/bin/perl
> `find ../../dircod/ -exec rm -f {} \;`;
>
> 2- (bonita):
> #!/usr/bin/perl
> unlink <../../dircod/*>;

Lembrando que glob (perldoc -f glob) é feio e pode levar a outros  
bugs, lembrem-se que o File::Find faz parte da distribuição Perl, e  
existem outros módulos além deste para procurar arquivos como o  
FIle::Find::Rule - sendo este último o meu preferido:

<code>
use File::Find::Rule;

unlink File::Find::Rule->file()->in('../../dircod/');
</code>

Boa sorte!

--
Igor Sutton
igor.sutton em gmail.com



-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20070530/5f942256/attachment.html 
-------------- Próxima Parte ----------
Um anexo não texto foi limpo...
Nome  : PGP.sig
Tipo  : application/pgp-signature
Tam   : 186 bytes
Descr.: This is a digitally signed message part
Url   : http://mail.pm.org/pipermail/cascavel-pm/attachments/20070530/5f942256/attachment.bin 


Mais detalhes sobre a lista de discussão Cascavel-pm