diff --git a/xargs b/xargs index b4a3ace..10eaa42 100644 --- a/xargs +++ b/xargs @@ -1,8 +1,16 @@ -# To Find all file name ending with .pdf and remove them -find -name *.pdf | xargs rm -rf +--- +syntax: bash +--- -# if file name contains spaces you should use this instead -find -name *.pdf | xargs -I{} rm -rf '{}' +# Find all files whose names end with .pdf and remove them: +find -type f -name '*.pdf' | xargs rm -f + +# If file names contain special characters, you should use this instead. +# Special characters include spaces, quotes, parenthesis, unicode, etc: +find -type f -name '*.pdf' -print0 | xargs --null rm -f + +# Run 4 `rm` commands in parallel +find -name '*.pdf' | xargs --max-procs=4 rm -f # Will show every .pdf like: # &toto.pdf=