May-22-2019, 12:58 PM
everyone,
I am trying to get a list of directories and files on a network drive.
My code is:
I enter: r”20.2.2.44:” for example, in that exact format. The problem is when I input the network drive (ex:r”20.2.2.44:”)(which I know has and folders file) the list (driv) returns blank. No errors are thrown. The script proceeds to the remainder of the code dedicated to manipulate the list (driv). If I enter: r”c:” the list (driv) is populated.
How do I format my input so the network drive will populate the list (driv)? Are there any other factors besides the formatting of the input that would prevent os.listdir from working on a network drive?
python version 2.7.5
IDLE version 2.7.5
OS: Windows 7 professional
Also if any of you know good sources about python on network drives, please refer me.
LCONNER
I am trying to get a list of directories and files on a network drive.
My code is:
print 'running...'
# imports
import os, sys
from os import listdir
import arcpy, os
import os
import os.path
import csv
#set root and make list
path = input ('enter directory for searching: ')
driv = os.listdir( path ) #list of folders
print driv
maplist = []
## more code to manipulate list I enter: r”20.2.2.44:” for example, in that exact format. The problem is when I input the network drive (ex:r”20.2.2.44:”)(which I know has and folders file) the list (driv) returns blank. No errors are thrown. The script proceeds to the remainder of the code dedicated to manipulate the list (driv). If I enter: r”c:” the list (driv) is populated.
How do I format my input so the network drive will populate the list (driv)? Are there any other factors besides the formatting of the input that would prevent os.listdir from working on a network drive?
python version 2.7.5
IDLE version 2.7.5
OS: Windows 7 professional
Also if any of you know good sources about python on network drives, please refer me.
LCONNER
