The only problem with this is that it doesn't indicate which items are in which directory. Since it can be different, it should be a parameter. You can see how this is done in the actual solution, given below. This program lists the contents of a directory specified by the user. The contents of subdirectories are also listed, up to any level of nesting.
Indentation is used to show the level of nesting.
The user is asked to type in a directory name. If the name entered by the user is not a directory, a message is printed and the program ends. Program needs a directory name. Print an error message. Otherwise, just print its name.