[lug] Removing hidden directory recursively

Garett Shulman shulmang at colorado.edu
Fri Apr 21 14:57:23 MDT 2006


I'de like to see a unix one-liner for this. However when I need to do 
this I use the following python function...

def rmsvn(current_dir):
        for current_dir_item in os.listdir(current_dir):
                try:
                        os.chdir(current_dir + "/" + current_dir_item)
                        if current_dir_item == ".svn":
                                os.system("rm -rf " + current_dir + "/" 
+ current_dir_item)
                        else:  
                                rmsvn(current_dir + "/" + current_dir_item)
                except:
                        continue


Paul Nowosielski wrote:
> Dear All,
>
> I'm trying to remove 1000's of .svn files from a web directory. 
> Can any one give me a tip on how to do this with a one line command?
>
> Best,
>
>   




More information about the LUG mailing list