最近需要将一个路径下面的所有.png的文件的绝对路径保存到一个txt中。路径的文件组织格式如下所示
/home/xxx/face_detection_mtcnn/pass_history_raw_align_11/test_data/no_mask/not_in/
1/
1.png
2.png
…
2/
1.png
2.png
…
…
诸如上面的文件组织格式。
我调研到一个指令:find /home/xxx/face_detection_mtcnn/pass_history_raw_align_11/test_data/no_mask/not_in/ -type f > /home/xxx/face_detection_mtcnn/1.txt。即可将所有png文件的绝对路径重定向到1.txt文件中。