Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux(bash)查找所有文件导入首先找到的下一行代码,重命名并重复_Linux_Bash_Gnome Terminal - Fatal编程技术网

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中变量操作的有趣链接:这绝对正确,那么,为什么我的程序总是只抓取找到的文件序列中的最后一个文件,对其进行处理,然后脚本就死了呢?