mkdir(make directory,创建目录)命令在Unix、DOS、OS/2和Microsoft Windows操作系统以及PHP脚本语言中用于创建一个目录。DOS、OS/2和Windows中,这条指令常被简写用作md。
用法
一般用法如下:
mkdir name_of_directory
name_of_directory是将被创建的目录名。如上所示输入后,会在当前目录下创建新目录。On Unix and Windows (with Command extensions enabled,[1]the default [2]), multiple directories can be specified, and mkdir will try to create all of them.
选项
在类Unix操作系统中,mkdir提供参数。最常用的三个参数为:
- -p: will also create all directories leading up to the given directory that do not exist already. If the given directory already exists, ignore the error.
- -v:显示mkdir创建的每个目录。通常与-p配合使用。
- -m:指定目录的octal permissions。
-p is most often used when using mkdir to build up complex directory hierarchies, in case a necessary directory is missing or already there. -m is commonly used to lock down temporary directories used by shell scripts.
参考资料
- ↑ Microsoft Windows XP - Mkdir. Microsoft. [25 October 2012].
- ↑ Microsoft Windows XP - Cmd. Microsoft. [25 October 2012].
外部链接
- Microsoft TechNet Mkdir article
- 单一UNIX®规范第7期,由国际开放标准组织发布 : make directories – 命令与工具(Commands & Utilities)参考,