R
Rob
Guest
At some point in your Linux life you'll come across a directory of session files (or something similar) that you want to remove. BUT, when you try to remove the files with linux's rm command you're met with the error message:
/bin/rm: Argument list too long
Fret not.. use find to remove these session files with it's -delete flag!
Let's say we're looking to delete files named session_848938, session_45949343, session_454344, etc.. and they live in /path/to/files/
[xcode=bash]find /path/to/files/ -name "session_*" -delete[/xcode]
Before I found out about find's cool -delete flag I'd pair up find with exec or xargs..
[xcode=bash]find /path/to/files/ -name "session_*" -exec rm {} \;
find /path/to/files/ -name "session_*" -print0 | xargs -0 rm[/xcode]
Now, however.. i'll use the -delete flag.
Does anyone know how long it's been around?
/bin/rm: Argument list too long
Fret not.. use find to remove these session files with it's -delete flag!
Let's say we're looking to delete files named session_848938, session_45949343, session_454344, etc.. and they live in /path/to/files/
[xcode=bash]find /path/to/files/ -name "session_*" -delete[/xcode]
Before I found out about find's cool -delete flag I'd pair up find with exec or xargs..
[xcode=bash]find /path/to/files/ -name "session_*" -exec rm {} \;
find /path/to/files/ -name "session_*" -print0 | xargs -0 rm[/xcode]
Now, however.. i'll use the -delete flag.
Does anyone know how long it's been around?