Linux 获取文件名称生成列表 txt - create_filelist

Linux 获取文件名称生成列表 txt - create_filelist

1. find
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/ 文件夹下所有 *.jpg (000001.jpg - 001050.jpg) 的路径 + 图片名信息写入 txt 文件。

1.1 ll

strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1$ ll
total 241056
drwxrwxr-x 2 strong strong  36864 Oct 30 17:24 ./
drwxrwxr-x 6 strong strong   4096 Jan 10 17:25 ../
-rw-rw-r-- 1 strong strong 230263 Aug  7  2015 000001.jpg
-rw-rw-r-- 1 strong strong 233663 Aug  7  2015 000002.jpg
-rw-rw-r-- 1 strong strong 236256 Aug  7  2015 000003.jpg
-rw-rw-r-- 1 strong strong 226686 Aug  7  2015 000004.jpg
-rw-rw-r-- 1 strong strong 225361 Aug  7  2015 000005.jpg
-rw-rw-r-- 1 strong strong 236972 Aug  7  2015 000006.jpg
……
-rw-rw-r-- 1 strong strong 234725 Aug  7  2015 001045.jpg
-rw-rw-r-- 1 strong strong 234834 Aug  7  2015 001046.jpg
-rw-rw-r-- 1 strong strong 247108 Aug  7  2015 001047.jpg
-rw-rw-r-- 1 strong strong 234094 Aug  7  2015 001048.jpg
-rw-rw-r-- 1 strong strong 233516 Aug  7  2015 001049.jpg
-rw-rw-r-- 1 strong strong 246251 Aug  7  2015 001050.jpg
strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1$


1.2 find /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04 -name *.jpg

strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$ find /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04 -name *.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000855.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000479.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000375.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000303.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000163.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000363.jpg
……
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000096.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000955.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000666.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000560.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000524.jpg
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/000128.jpg
strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$ 


1.3 find /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04 -name *.jpg > train_file.txt

strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$ find /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04 -name *.jpg > train_file.txt
strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$

注意:文本文件内的文件名是乱序排列的。
train_file.txt

Linux 获取文件名称生成列表 txt - create_filelist_第1张图片


2. ls
/home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/ 文件夹下所有 *.jpg (000001.jpg - 001050.jpg) 的路径 + 图片名信息写入 txt 文件。

2.1 ll

strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1$ ll
total 241056
drwxrwxr-x 2 strong strong  36864 Oct 30 17:24 ./
drwxrwxr-x 6 strong strong   4096 Jan 10 17:25 ../
-rw-rw-r-- 1 strong strong 230263 Aug  7  2015 000001.jpg
-rw-rw-r-- 1 strong strong 233663 Aug  7  2015 000002.jpg
-rw-rw-r-- 1 strong strong 236256 Aug  7  2015 000003.jpg
-rw-rw-r-- 1 strong strong 226686 Aug  7  2015 000004.jpg
-rw-rw-r-- 1 strong strong 225361 Aug  7  2015 000005.jpg
-rw-rw-r-- 1 strong strong 236972 Aug  7  2015 000006.jpg
……
-rw-rw-r-- 1 strong strong 234725 Aug  7  2015 001045.jpg
-rw-rw-r-- 1 strong strong 234834 Aug  7  2015 001046.jpg
-rw-rw-r-- 1 strong strong 247108 Aug  7  2015 001047.jpg
-rw-rw-r-- 1 strong strong 234094 Aug  7  2015 001048.jpg
-rw-rw-r-- 1 strong strong 233516 Aug  7  2015 001049.jpg
-rw-rw-r-- 1 strong strong 246251 Aug  7  2015 001050.jpg
strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1$


2.2 ls -R /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/*.jpg

strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$ ls -R /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/*.jpg

 

Linux 获取文件名称生成列表 txt - create_filelist_第2张图片


2.3 ls -R /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/*.jpg > test_file.txt

strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$ ls -R /home/strong/MOTChallenge/MOT16/MOT16/train/MOT16-04/img1/*.jpg > test_file.txt
strong@foreverstrong:~/MOTChallenge/MOT16/MOT16/train/MOT16-04$

test_file.txt

Linux 获取文件名称生成列表 txt - create_filelist_第3张图片

 

你可能感兴趣的:(Darknet)