zoukankan      html  css  js  c++  java
  • mkdir

    mkdir 参数选项
    -p  递归创建目录,若所要建立目录的上层目录目前尚未建立,则会一并建立上层目录。
    -m 设置新创建目录的默认目录对应的权限。
    -v 显示创建目录的过程。
     
    范例. 创建目录时可使用 -m 参数设置目录的默认权限。
    [root@testdb62 test]# mkdir -m 700 mydir
    [root@testdb62 test]# ls -ld mydir
    drwx------ 2 root root 6 12月 10 19:40 mydir
    
    
    
    范例. 同时创建多个目录及多级子目录。
    [root@testdb62 test]# mkdir -pv test2/{dir1_1,dir1_2}/{dir2_1,dir2_2}
    mkdir: created directory ‘test2’
    mkdir: created directory ‘test2/dir1_1’
    mkdir: created directory ‘test2/dir1_1/dir2_1’
    mkdir: created directory ‘test2/dir1_1/dir2_2’
    mkdir: created directory ‘test2/dir1_2’
    mkdir: created directory ‘test2/dir1_2/dir2_1’
    mkdir: created directory ‘test2/dir1_2/dir2_2’
    [root@testdb62 test]# 
    [root@testdb62 test]# tree -d test2
    test2
    ├── dir1_1
    │   ├── dir2_1
    │   └── dir2_2
    └── dir1_2
        ├── dir2_1
        └── dir2_2
    
    6 directories
    
     
    
    范例. 克隆目录结构
    先创建示例目录:
    [root@testdb62 test]# mkdir -p test3/dir{1..5} test4/{a..e}
    [root@testdb62 test]# tree -d test3/ test4/
    test3/
    ├── dir1
    ├── dir2
    ├── dir3
    ├── dir4
    └── dir5
    test4/
    ├── a
    ├── b
    ├── c
    ├── d
    └── e
    
    10 directories
     
    执行相关脚本克隆目录
    说明 --noreport 参数不显示最后一行统计信息。
    [root@testdb62 test]# tree -fid --noreport test3 >> /tmp/cpdir.txt
    [root@testdb62 test]# cd /tmp
    [root@testdb62 tmp]# mkdir -p `cat /tmp/cpdir.txt`
    [root@testdb62 tmp]# tree -d /tmp/test3/
    /tmp/test3/
    ├── dir1
    ├── dir2
    ├── dir3
    ├── dir4
    └── dir5
    
    5 directories
  • 相关阅读:
    hdu 1425 sort 解题报告
    codeforces B. Jeff and Periods 解题报告
    codeforces A. Jeff and Digits 解题报告
    codeforces B. Xenia and Spies 解题报告
    Python 条件判断的使用
    Python Apache日志处理脚本(初稿)
    Python函数定义
    Python多条件配合使用
    Python循环的使用(2)
    NavigationController导航栏中添加多个UIBarButtonItem
  • 原文地址:https://www.cnblogs.com/l10n/p/9416427.html
Copyright © 2011-2022 走看看