linux - Linux(bash) find all files import first find to the next line of some code and rename and repeat
问题描述
如何在此条件下找到文件夹中的所有文件"someting".mp4
将其导入下一个命令,然后我将修改后的文件名称(找到的文件的重命名版本)像这样"something"_Fast.mp4
导入命令的另一部分?
像这样的东西:
Repeat until there are no files left.
Find all files containing condition "someting".mp4
Program_name.py --input_file "something".mp4 --output_file "something"_Fast.mp4
此外,它不能选择新创建的文件。
解决方案
例如,它接受文件名的任何字符,甚至 LineFieeds 和其他空格。$FOLDER
递归搜索目录。将其替换.
为当前目录。
find "$FOLDER" -type f -name '*.mp4' -print0 |
while IFS= read -r -d $'\0' file
do
echo "$file"
Program_name.py --input_file "$file" --output_file "${file%.mp4}_Fast.mp4"
done
推荐阅读
- javascript - 新用户输入后如何更新 JSON 查询/数据?
- odoo - 按钮单击 odoo 网站时生成警告
- python - 如何计算重叠轮廓
- post - 通过 ServiceNow Table API 创建知识库文章
- ios - UICollectionView cellForItemAt 在滚动时被调用两次
- arrays - 如何将字符串添加到Powershell中数组中的重复元素
- ruby-on-rails - Devise 的默认登录方法是什么(例如 http-auth、token-auth)以及如何正确设置?
- r - 如何根据从其先前值的减少百分比将向量/变量分离为两种状态
- python - 退出 pygame 窗口后出现 pygame 错误
- typescript - React Native 加密与 TypeORM 一起使用的数据库