I have a server. Client can send a path and server should cd to that path. But here is the thing. Imagine I have a test2 directory in test1 directory and the path to test1 directory is C:\test1. The client can access test2 by cd test2 and \test1\test2 and if he wants to go back he can use \test1 (I searched and found os.chdir but it needs the full path and I don't have it) and he shouldn't be free to send E:\something or anything like that. Just the directories that are in test1. what do you suggest? what can I use to achieve this?
You can store the default path as a kind of root path and path.join(root, client_path) this way you have a complete path that has to start with C:\test1
The issue you have to overcome is deciding if you have to join the current path or the root path with the client's command. I would first check if the directory exists in the current working directory if not I would try finding it in the "root" path
Change directory in a server without leaving the working directory