RE: Recursively delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>
> >Try this command. Make sure you are in the correct directory.
> >
> >find .-name "file*" -exec rm -f {} \;
>        ^
>        |
>      oops
>
> Technically, the above won't work, but this will:
>
> 	find . -name "file*" -exec rm -f {} \;
>
> The specific request would be:
>
> 	find . -name \*.o -exec rm -f {} \;
>
> With the above, one has to be in the correct starting directory, otherwise
> replace the "dot" with the starting path.
>
> MB
>

I would do tihs

find . -type f -name "*.o" -print | more

Do that first to see what you will be deleting. If it all looks good, then

find . -type f -name "*.o" -exec rm -f () \;
or
find . -type f -name "*.o" -print | xargs rm -f

(both will do the same thing, the second one is easier for me to remember).


Ben






-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux