How many times did i create a directory

/Users/jafar

jafars-mbp:~ jafar$ pwd

/Users/jafar

jafars-mbp:~ jafar$ pwd

/Users/jafar

jafars-mbp:~ jafar$ pwd

/Users/jafar

jafars-mbp:~ jafar$ cd ~

jafars-mbp:~ jafar$ pwd

/Users/jafar

jafars-mbp:~ jafar$ cd ~

jafars-mbp:~ jafar$ mkdir temp

mkdir: temp: File exists

jafars-mbp:~ jafar$ mkdir temp/stuff

mkdir: temp/stuff: File exists

jafars-mbp:~ jafar$ mkdir temp/stuff/things

mkdir: temp/stuff/things: File exists

jafars-mbp:~ jafar$ mkdir temp/stuff/things/frank/joe/alex/john

mkdir: temp/stuff/things/frank/joe/alex/john: File exists

jafars-mbp:~ jafar$

hi guys, I have a question, I hope someone can answer my question. in the above text directly from zed shaws book learn python the hardway. I realize that it may not be a very smart question. But how many frank and john and joe folders did i create? and also how many Temp and stuff folders did I create? is it more than one?

thanks,
jafar

If you run ls -r ~/temp, you’ll recursively list the contents of ~/temp, which will show you everything in the ~/temp directory and everything in every directory it contains. For what it’s worth, mkdir some_name only works if the directory some_name doesn’t exist in the target location. So there should only be one of each.

A free service run by Zed A. Shaw for learncodethehardway.org.