Linux系統中如何一次創建和刪除多個文件/文件夾

Linux系統中如何一次創建和刪除多個文件/文件夾

1.創建/刪除多個文件

//連續創建5個文件,文件名爲file1、file2、..file5
[root@server ~]# touch file{1..5}
[root@server ~]# ls
anaconda-ks.cfg  Downloads  file3  hello    install.log         Pictures   test
Desktop          file1      file4  hello.c  install.log.syslog  Public     Videos
Documents        file2      file5  hello.o  Music               Templates
[root@server ~]# rm -rf file*

2.創建/刪除多個目錄

[root@server ~]# mkdir folder{1..5}
[root@server ~]# ls
anaconda-ks.cfg  file1  file5    folder4  hello.o             Pictures   Videos
Desktop          file2  folder1  folder5  install.log         Public
Documents        file3  folder2  hello    install.log.syslog  Templates
Downloads        file4  folder3  hello.c  Music               test

[root@server ~]# rm -rf folder*
[root@server ~]# ls
anaconda-ks.cfg  Downloads  file3  hello    install.log         Pictures   test
Desktop          file1      file4  hello.c  install.log.syslog  Public     Videos
Documents        file2      file5  hello.o  Music               Templates
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章