千家信息网

Linux系统中如何一次创建和删除多个文件/文件夹

发表于:2025-02-04 作者:千家信息网编辑
千家信息网最后更新 2025年02月04日,Linux系统中如何一次创建和删除多个文件/文件夹1.创建/删除多个文件//连续创建5个文件,文件名为file1、file2、..file5[root@server ~]# touch file{1.
千家信息网最后更新 2025年02月04日Linux系统中如何一次创建和删除多个文件/文件夹

Linux系统中如何一次创建和删除多个文件/文件夹

1.创建/删除多个文件

//连续创建5个文件,文件名为file1、file2、..file5[root@server ~]# touch file{1..5}[root@server ~]# lsanaconda-ks.cfg  Downloads  file3  hello    install.log         Pictures   testDesktop          file1      file4  hello.c  install.log.syslog  Public     VideosDocuments        file2      file5  hello.o  Music               Templates[root@server ~]# rm -rf file*

2.创建/删除多个目录

[root@server ~]# mkdir folder{1..5}[root@server ~]# lsanaconda-ks.cfg  file1  file5    folder4  hello.o             Pictures   VideosDesktop          file2  folder1  folder5  install.log         PublicDocuments        file3  folder2  hello    install.log.syslog  TemplatesDownloads        file4  folder3  hello.c  Music               test[root@server ~]# rm -rf folder*[root@server ~]# lsanaconda-ks.cfg  Downloads  file3  hello    install.log         Pictures   testDesktop          file1      file4  hello.c  install.log.syslog  Public     VideosDocuments        file2      file5  hello.o  Music               Templates
0