Wednesday, July 13, 2016

Creating nested directories in UNIX

hadoop@ubuntu:~$ mkdir dir1/dir2
mkdir: cannot create directory `dir1/dir2': No such file or directory

Oops. To achieve this, we need to user mkdir with the 'p' switch.

hadoop@ubuntu:~$ mkdir -p dir1/dir2
drwxrwxr-x  3 hadoop hadoop  4096 Jul 13 15:57 dir1
hadoop@ubuntu:~$ cd dir1
hadoop@ubuntu:~/dir1$ ls
dir2

No comments:

Post a Comment