Xargs and spaces in file path
I'm trying to delete some mp3 from my backup server to free up some space and was using locate and xargs to do this. This works well except when there is a space in the file path. How can I pass the file path to xargs with quotes so the rm command can be able to parse the file path. this is what the command I'm issuing
locate *.mp3 | xargs rm
locate --print0 *.mp3 | xargs -0 -n 10 echo
I'm not sure if it will work. It works here in small scale, but when I push the whole locate trough, it gives a error msg. Anyway, the --print0 option sends a ascii0 at the end of the filename, and -0 option on xargs uses this null as a argument seperator. Finally -n limits the execution to 10 files at a time.
If it works, change echo with rm :)
|All times are GMT -5. The time now is 10:54 AM.|