This isnt a duplicate, as the original answer did not help into implementing it into my raw input command interpreter. Credit to original question/answer where due.
So I'm working on a DOS style Operating System in python and I was wondering how or even if it is possible to execute a command that would let me switch between directories like a regular command prompt would let you do.
Im not sure how well I'm explaining myself but basically I would have the same command as cd
in terminal so I could read files imbedded in folders, change between folders etc. I don't need any sort of limit on how complex it is but i would prefer if it isn't too long.
I have yet to find a clear solution to this. in a best case scenario, this is all you would need to input
cd folder1
cd folderinfolder1
this would be inputted into a raw input
or a input
and then executed so im assuming it would require splits so it knows that before the space there is cd
and after the space there is the filename, such as folder
I am also have an issue with using os.listdir
only showing files, and not any folders.
it would be used like this
directory=raw_input("enter cd followed with a directory")
This might be a bit much to ask, not even sure if it is possible