Python http server with multiple directories
Question:
Is it possible to add multiple variable paths in os.chdir method from two different directories like, var1 =’d:\folder1′ , var2 = ‘e:\folder2’? and then putting them in os.chdir(var1,var2).
I tried but could not join them, got a syntax error.
thanks
Answers:
I managed to do it using symbolic links:
On windows, you can create symbolic links to directories as so:
mklink /D <symbolic link name> <destination directory>
So in a new folder you can run:
mklink /D folder1 "D:folder1"
mklink /D folder2 "E:folder2"
On linux this would be:
ln -s <destination directory> <symbolic link name>
ln -s /mnt/d/folder1 folder1
ln -s /mnt/e/folder2 folder2
Then by running a python HTTP server in the directory, you can access both folders as sub-folders of the server:
Is it possible to add multiple variable paths in os.chdir method from two different directories like, var1 =’d:\folder1′ , var2 = ‘e:\folder2’? and then putting them in os.chdir(var1,var2).
I tried but could not join them, got a syntax error.
thanks
I managed to do it using symbolic links:
On windows, you can create symbolic links to directories as so:
mklink /D <symbolic link name> <destination directory>
So in a new folder you can run:
mklink /D folder1 "D:folder1"
mklink /D folder2 "E:folder2"
On linux this would be:
ln -s <destination directory> <symbolic link name>
ln -s /mnt/d/folder1 folder1
ln -s /mnt/e/folder2 folder2
Then by running a python HTTP server in the directory, you can access both folders as sub-folders of the server: