Create subfolder within folder in one command

suppose if i am checking folder g as shown below path
a/b/c/d/e/f/g ,and some directory c,d,e,f,g not present then is there anyway to create directory in one command
or i need to use mkdir for everyfolder

Hi

mkdir -p a/b/c

Guru.

1 Like

and if the end one is a file ?
for eg
/a/b/c/d/e/f.txt
and i want to copy file f.txt to above location and d and e directory missing then

Hi

mkdir -p /a/b/c/d/e
cp f.txt  /a/b/c/d/e

Guru.