Skip to content Skip to sidebar Skip to footer

Accessing A Network Folder Through A Python Program

Just a brief outline of what I'm doing: I'm trying to automate some pdf merging routine with python in a network directory, which involves copying, deleting and creating files at a

Solution 1:

I would not use pushd/popd in such a way, I would just include the full paths, including network paths in the paths of whatever file operation I need to do

However if I really need to change working directory, I would do this with python:

import os

original_working_directory = os.getcwd()

# do stuff

new_networked_directory = r'\\server\share\folder'# change to the networked directory
os.chdir(new_networked_directory)

# do stuff#changeback to original working directory
os.chdir(original_working_directory)

# do more stuff

There should be no need for "temp drives" or the like really.

Post a Comment for "Accessing A Network Folder Through A Python Program"