Suppose my current directory is A. I want to create a directory B and a file \"myfile.txt\" inside B.
How to do th
For this purpose, you can create your own function. For example:
$ echo 'mkfile() { mkdir -p "$(dirname "$1")" && touch "$1" ; }' >> ~/.bashrc
$ source ~/.bashrc
$ mkfile ./fldr1/fldr2/file.txt
Explanation:
~/.bashrc
file using the echo
command-p
flag is for creating the nested folders, such as fldr2
~/.bashrc
file with the source
commandmkfile
function to create the file