Linux:批量操纵有序文件名的文件或路径
在Linux中,我们通常会用以下的方法去重建一批文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
[root@localhost script]# pwd /script [root@localhost script]# [root@localhost script]# ls -ltr total 0 [root@localhost script]# [root@localhost script]# mkdir -p the_world/{human/{iron_man},angel,god/{thorns,odin}} [root@localhost script]# [root@localhost script]# tree ../script/ ../script/ └── the_world ├── angel ├── god │ ├── odin │ └── thorns └── human └── {iron_man} 7 directories, 0 files [root@localhost script]# [root@localhost script]# mkdir -p numbers/{1,2,3,4,5,6} [root@localhost script]# [root@localhost script]# tree ../script/ ../script/ ├── numbers │ ├── 1 │ ├── 2 │ ├── 3 │ ├── 4 │ ├── 5 │ └── 6 └── the_world ├── angel ├── god │ ├── odin │ └── thorns └── human └── {iron_man} 14 directories, 0 files [root@localhost script]# |
假设场景:
1. 我需要创建文件名连续的一组文件
2. 但是因为数量过大,我不能够一一列出来
比较正常的思路是通过【for】循环来实现。
这种方式是一定可以[……]