Create directories using mkdir
It works like this:
Create Intermediate Directories (
Verbose Output (
A note on notation:
Directories is a great place to store and organize files, and creating them is easy. The mkdir
command is used to create directories. To create a directory we can use the mkdir
command followed by the name of the directory we wish to create.
mkdir directory...
Note: the three periods follow an arguments in the description in above, it means that the arguments can be repeated.
$ mkdir foo $ ls -l drwxr-xr-x 2 bindi staff 68 15 Sep 23:17 foo
$ mkdir foo bar $ ls -l drwxr-xr-x 2 bindi staff 68 15 Sep 23:17 foo drwxr-xr-x 2 bindi staff 68 15 Sep 23:17 bar
Create Intermediate Directories ( -p
)
The mkdir
command allows us to create nested directories using the -p
flag.
$ mkdir -p foo/bar/now $ ls -la /foo/bar/now total 0 drwxr-xr-x 2 robin staff 68 16 Sep 00:38 . drwxr-xr-x 3 robin staff 102 16 Sep 00:38 ..
Above shos the ls
command to see that now directory exists and currently empty.
Verbose Output ( -v
)
The mkdir
command supports a verbose mode flag, -v
. Adding the -v
flag will print the results of mkdir
to the console.
$ mkdir -v foo madir: created directory 'foo'
Using the -v
flag can provide useful report when writing scripts with lot of commands.
Latest Post
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Combine JavaScript and CSS
- Inline Small JavaScript and CSS
- Minify JavaScript and CSS
- Defer Parsing of JavaScript
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Percentile
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync