make directory on demand

September 14th, 2006 mysurface Posted in Common, mkdir | Hits: 32620 | No Comments »

Make directory is a very common command line, mkdir. I am here to show only mkdir with -p in case you donno.

With -p allows you to creat sub sub directory even the parent directory is not exist by default, let say you want to create “script” directory under /usr/src/firewall, but you are not sure whether src or firewall is it exist. You can do this

mkdir -p /usr/src/firewall/script

Even if the parent directories doesn exist, it will not complain. Instead it will create it on demand and if the directory is there, it will not complain too, but silently ignore the operation.

Leave a Reply