Running command line on multiple music files

夙愿已清 提交于 2019-12-20 07:19:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!