Skip to content
Open

Xargs #218

Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions xargs
Original file line number Diff line number Diff line change
@@ -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
Comment thread
edgester marked this conversation as resolved.
Outdated

# 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
Comment thread
edgester marked this conversation as resolved.
Outdated

# Run 4 "rm" commands in parallel
find -name "*.pdf" | xargs --max-procs=4 rm -f
Comment thread
edgester marked this conversation as resolved.
Outdated

# Will show every .pdf like:
# &toto.pdf=
Expand Down