2019-11-06 16:20:51 +00:00
|
|
|
# Find all file names ending with .pdf and remove them
|
2017-05-25 10:22:44 +00:00
|
|
|
find -name \*.pdf | xargs rm
|
2019-11-06 16:20:51 +00:00
|
|
|
# The above, however, is preferable written without xargs:
|
|
|
|
find -name \*.pdf -exec rm {} \+
|
|
|
|
# Or, for find's own functionality, it's best as:
|
|
|
|
find -name \*.pdf -delete
|
2017-05-25 10:22:44 +00:00
|
|
|
|
2019-11-06 16:20:51 +00:00
|
|
|
# Find all file name ending with .pdf and remove them
|
2017-05-25 16:48:40 +00:00
|
|
|
# (bulletproof version: handles filenames with \n and skips *.pdf directories)
|
|
|
|
# -r = --no-run-if-empty
|
|
|
|
# -n10 = group by 10 files
|
2019-04-16 19:57:17 +00:00
|
|
|
find -name \*.pdf -type f -print0 | xargs -0rn10 rm
|
2017-05-25 16:48:40 +00:00
|
|
|
|
2019-11-06 16:20:51 +00:00
|
|
|
# If file name contains spaces you should use this instead
|
2017-05-25 10:22:44 +00:00
|
|
|
find -name \*.pdf | xargs -I{} rm -rf '{}'
|
|
|
|
|
|
|
|
# Will show every .pdf like:
|
2020-03-16 19:51:55 +00:00
|
|
|
# &toto.pdf=
|
|
|
|
# &titi.pdf=
|
2017-05-25 10:22:44 +00:00
|
|
|
# -n1 => One file by one file. ( -n2 => 2 files by 2 files )
|
|
|
|
find -name \*.pdf | xargs -I{} -n1 echo '&{}='
|
2019-11-06 16:20:51 +00:00
|
|
|
# The above is, however, much faster and easier without xargs:
|
|
|
|
find -name \*.pdf -printf "%p\n"
|
2017-05-25 10:22:44 +00:00
|
|
|
|
2019-11-06 16:20:51 +00:00
|
|
|
# Group words by three in a string
|
|
|
|
seq 1 10 | xargs -n3
|