Windows批处理文件以删除音频文件(具有长度要求) [英] Windows Batch File to Delete Audio Files, with Length Requirement

查看:109
本文介绍了Windows批处理文件以删除音频文件(具有长度要求)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

,谢谢您的帮助.我尝试搜索有关如何完成以下操作的示例,但未找到任何内容.由于我没有创建BAT文件的经验,因此将不胜感激!

and thank you for any help. I have tried searching for an example on how to accomplish the following, but haven't found anything. Any help would be appreciated as I have no experience in creating a BAT file!

我有一个第三方程序,该程序可以录制音频,并从中生成一个.mp3文件.每隔24小时,它将生成一个新文件夹,然后重新开始该过程.问题是,即使是一丁点的声音也会生成一个.mp3文件.我剩下不到一秒钟的数千个.mp3文件.我想删除所有子目录中所有少于2秒长度的音频文件.我该怎么办?BAT文件是完成此任务的正确方法吗?手动对许多目录中的文件进行排序的方法非常耗时,因为在我能够浏览它们之前,将生成20到30天的文件.

I have a third party program that records audio, and generates an .mp3 file from it. Every 24 hours, it generates a new folder, and begins the process all over again. The problem is, even the slightest bit of sound will generate an .mp3 file. I am left with thousands of .mp3 files that are less than 1 second. I would like to delete all audio files in all of the subdirectories with a length of less than 2 seconds. How can I go about this, and is a BAT file the correct way to accomplish this? The manual way of sorting the files in the many, many directories is a very time consuming process as 20 - 30 days of files will be generated before I am able to go through them.

推荐答案

For a GUI solution:共享软件完整的Total Commander可以列出完整的目录树(控件B)并按文件大小排序(控件F6),并且也只能显示MP3文件如果需要的话.

For a GUI solution: The shareware uncrippled Total Commander can list a full directory tree (control B) and sort by filesize (control F6) and can also display only MP3 files if needed.

此任务只需要您在单个窗格中标记小于x MB的文件大小,然后即可一次将其全部删除.

This task would just need you to mark the filesizes less than x MBytes in a single pane and then you can delete them all at once.

batch file提供了另一种解决方案,用于删除2.999秒或以下的MP3文件:
-将 [210] 更改为 [10] ,以最多删除1.999秒.

Another solution is available with a batch file to delete MP3 files of 2.999 seconds or below:
- change [210] to [10] to delete files up to 1.999 seconds.

从SourceForge下载Mediainfo command line version
在下面的第2行中将可执行文件的路径更改为
在文件树的主文件夹中启动此批处理文件
如果您在屏幕上看到的del命令正确,则删除echo并再次运行以删除文件.

Download Mediainfo command line version from SourceForge
Change the path to the executable in line 2 below
Launch this batch file in the main folder of the tree of files
If the del commands you see on the screen are right then remove the echo and run it again to delete the files.

@echo off
set "exe=c:\Util\MediaInfo\MediaInfo.exe"
for /r %%a in (*.mp3) do (
"%exe%" -f "%%a" |find "Duration" | findstr /r ": 00:00:0[210]" >nul && echo del "%%a"
)
pause

这篇关于Windows批处理文件以删除音频文件(具有长度要求)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆