Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.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
List 列出文件夹和子文件夹中早于X天的所有文件的完整路径,并将结果保存在文本文件中_List_File_Path - Fatal编程技术网

List 列出文件夹和子文件夹中早于X天的所有文件的完整路径,并将结果保存在文本文件中

List 列出文件夹和子文件夹中早于X天的所有文件的完整路径,并将结果保存在文本文件中,list,file,path,List,File,Path,我熟悉Shell编程,我一直在努力编写以下要求 1-列出文件夹及其子文件夹中早于X天的所有文件 2-列出每个文件的名称和完整路径 3-将结果写入文本文件 谢谢你的帮助 脚本是: MY_DIR1=“/media/nssvolumes/TEST/ORIGIN find$MY_DIR1-mindepth 0-maxdepth 3-mtime+1-type f 查找$MY_DIR1 | sed:“$DIR”:>toto.txt您在哪个部分遇到问题?如果您想避免sed,可以执行以下操作: cd $MY_D

我熟悉Shell编程,我一直在努力编写以下要求

1-列出文件夹及其子文件夹中早于X天的所有文件 2-列出每个文件的名称和完整路径 3-将结果写入文本文件

谢谢你的帮助

脚本是:

MY_DIR1=“/media/nssvolumes/TEST/ORIGIN
find$MY_DIR1-mindepth 0-maxdepth 3-mtime+1-type f

查找$MY_DIR1 | sed:“$DIR”:>toto.txt

您在哪个部分遇到问题?如果您想避免sed,可以执行以下操作:

cd $MY_DIR1 && find . -mindepth 0 -maxdepth 3 -mtime +1 -type f > toto.txt
如果要保留当前目录,请在子shell中用括号括起整个操作