Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
261 views
in Technique[技术] by (71.8m points)

linux - Is it possible to recursively create folders using shell script?

Im trying to create recursively level of directories like /folder1/folder2/folder3

Im trying this mkdir folder1/folder2/folder3, but doesnt work. how can I do it?

thanks

question from:https://stackoverflow.com/questions/8274920/is-it-possible-to-recursively-create-folders-using-shell-script

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should pass the -p parameter to mkdir so it will create all the subfolders. So following your example:

mkdir -p folder1/folder2/folder3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...