问题
I am using a CLI program called metaflac (http://flac.sourceforge.net/documentation_tools_metaflac.html) to remove padding from various FLAC music files on my computer. Using the following command in a batch file (with metaflac.exe in the same folder) successfully completes this task for an individual file:
metaflac --dont-use-padding --remove --block-type=PADDING "filename.flac"
I have to do this for several thousand files and don't want to do it all manually/individually. Is there an easy way for me to simply direct this command to a directory and have it act upon every file in there? This would save me a lot of time.
Thanks!
I am using Windows 7 64-bit.
回答1:
Sure. You can do it with a one-liner from a cmd
prompt.
for /f "delims=" %I in ('dir /s /b *.flac') do metaflac --dont-use-padding --remove --block-type=PADDING "%I"
If you're putting this into a .bat
script, change %I
to %%I
in both places.
回答2:
for /f "delims=" %%i in ('dir /s /b /a-d "C:\start\directory\*.flac"') do (
metaflac --dont-use-padding --remove --block-type=PADDING "%%~fi"
)
should do this for you, scanning the entire directory tree from "C:\start\directory" for all .flac
files and executing metaflac
against each with your parameters.
Suggest you try a small copied subtree first, for safety's sake.
来源:https://stackoverflow.com/questions/16086490/running-command-line-on-multiple-music-files