Knowledgebase

Portal Home > Knowledgebase > Articles Database > can't rm -rf afterward


can't rm -rf afterward




Posted by ti_nhatrang, 07-20-2012, 05:36 AM
Hi all, I have this command which runs great, but I am trying to rm the file after the conversion but it's not helping me: Thank you for helping in advance.

Posted by krizag, 07-20-2012, 06:43 AM
What does the command return?

Posted by ti_nhatrang, 07-20-2012, 01:21 PM
nothing, it just skip it and go to the next 'do'

Posted by wartungsfenster, 07-20-2012, 02:10 PM
that cannot work, anything after the pipe is no longer part of the xargs call.

Posted by kar1181, 07-21-2012, 06:56 AM
As said above the pipe symbol terminates the xargs command and passes its output to the next command, in this case your rm -r. To achieve what you're trying to do, just pass off a full command line to sh to run it in a subshell, i.e. use this: find . -type f -name '*.flac' -print0 | xargs -0i sh -c 'ffmpeg -i {} -acodec libmp3lame -ab 320k "{}.mp3" && rm -rf {}'

Posted by wartungsfenster, 07-21-2012, 07:45 AM
You might love http://www.in-ulm.de/~mascheck/various/find/#xargs (I so rarely had a use case for any of that... I think xargs 3-4 times in 10 years, and + once(!) Normally you just shouldnt have any unstructured folder/file structures to need to use and tune find)



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
TurboDNSHosting ???? (Views: 552)
FTP between servers? (Views: 526)


Language:

Contact us