0

i read out directory paths and try to pipe them into a comand with parameter -f

the individual commands look like this

printf '%s\n' /mnt/convert/*
convert -f /mnt/convert/example.mp4

the output of printf might be:

/mnt/convert/vid1.mp4
/mnt/convert/vid2.mp4
/mnt/convert/vid3.mp4
...

the goal is (pseudocode):

printf '%s\n' /mnt/convert/* | xargs convert -f

how would I best achieve this? right now I receive the error:
Error: Got unexpected extra argument (/mnt/convert/vid1.mp4)

julian bechtold
  • 1,875
  • 2
  • 19
  • 49
  • See linked https://stackoverflow.com/questions/199266/make-xargs-execute-the-command-once-for-each-line-of-input, you should run `xargs -n1 ...` to run `convert -f` each time for every input line(s) – jjo Sep 13 '21 at 15:49
  • lol thank you, the exact same question I already found and linked to the issue – julian bechtold Sep 13 '21 at 15:51

0 Answers0