Hi, how to delete several files in a recursive way
    David Kramer 
    david-8uUts6sDVDvs2Lz0fTdYFQ at public.gmane.org
       
    Mon Mar  1 01:32:19 EST 2010
    
    
  
Cole Tuininga wrote:
> Franco castro wrote:
>> Hi, I need to delete all .htaccess in all folders, but we are talking about
>> houndreds of folders, I need to figuer out how to "find and destroy" delete
>> all those files, I'm not very good with bin bash scripting, so maybe any of
>> yours know how to do it, tnks =)
> 
> How about something along the lines of:
> 
> find /path/to/base/dir -name .htaccess -exec rm -i {} \;
> 
> If you're brave, you can change the -i to -f to make it not ask you
> about each and every file, but that sounds dangerous to me...
Sorry I didn't see your reply before sending mine.  I would NOT do it
that way, because you're launching a shell for each file found.  I
suggested:
find /var/www -name .htaccess -delete
However, if you're paranoid, back them up like this first:
tar cvzf /tmp/htaccessfiles.tgz `find /var/www -name .htaccess`
    
    
More information about the Discuss
mailing list