Linux(bash)查找所有文件导入首先找到的下一行代码,重命名并重复
如何查找文件夹中具有此条件的所有文件Linux(bash)查找所有文件导入首先找到的下一行代码,重命名并重复,linux,bash,gnome-terminal,Linux,Bash,Gnome Terminal,如何查找文件夹中具有此条件的所有文件“someting”.mp4将其导入到下一个命令中,然后在下一个命令中,我将修改后的文件名(找到的文件的重命名版本)导入到命令的另一部分中,例如“something”\u Fast.mp4 大概是这样的: Repeat until there are no files left. Find all files containing condition "someting".mp4 Program_name.py --input_fi
“someting”.mp4
将其导入到下一个命令中,然后在下一个命令中,我将修改后的文件名(找到的文件的重命名版本)导入到命令的另一部分中,例如“something”\u 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
此外,它不能拾取新创建的文件。例如,它接受任何字符作为文件名,甚至包括行号和其他空格。递归搜索目录
$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
例如,它接受任何字符作为文件名,甚至包括linefieds和其他空格。递归搜索目录
$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
一个关于BASH中变量操作的有趣链接:这是绝对正确的,那么为什么我的程序总是只获取找到的文件序列中的最后一个文件,然后处理它,然后脚本就死了?一个关于BASH中变量操作的有趣链接:这绝对正确,那么,为什么我的程序总是只抓取找到的文件序列中的最后一个文件,对其进行处理,然后脚本就死了呢?