Delete All Files in A dir function
Made this initially to remove all .DS_Store files in a directory. Now it is it's own function! Just pass the target and watch it be rm'd!!
removeall () {
find . -name $1 -print0 | xargs -0 rm -v
}
How to use this
removeall .DS_Store
or
removeall '*.cache'
What the function does
this func will recursively remove all .DSStore files in the current directory. I will step through the code:
* find the file
* that matches the name $1 (name in the argument ex: *.DSStore*)
* run a command on each result
* remove the file
* print out what was done
To use this just add it to your ~/.bashrc
Or if you are cool, your ~/.zshrc file.
modified from this post at binary age
Written by James Doyle
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#