I want to split mp4 files that are greater than 500MB into segments smaller than 500MB.
How do I create a for loop to iterate over a directory of files, running
mp4box -splits 500000 input.mp4
on each file greater than 500 MB?
(The loop part is not a problem. The testing for filesize part is.)
CodePudding user response:
You can use find for this:
find ./ -name "*.mp4" -size 500M -exec mp4box -splits 500000 {} \;
(I didn't test it, but it should be something like that)
CodePudding user response:
With zsh:
for f ( *.mp4(.Lk 500000) ) mp4box -splits 500000 $f
Glob qualifiers: (.) to match plain files, (Lk 500000) to match files greater than 500000 KB in size. Add (D) to the qualifiers to include dotfiles.
CodePudding user response:
You can perhaps use find, e.g.:
for file in $( find . -size 500M )
do
echo $file
done
But I don't know if find is available with macos.
CodePudding user response:
you can use stat
for example :- stat filename.txt
note: it shows the size in bytes
