I am making a simple program using python which takes two inputs from the user:- filename which is the name of the file which the user wants to search. pathname which is the path where the user wants to search the file. I am using os module in my code. But, I want that my program should not search for the file in shortcuts. So, is there a way by which we can check whether a folder is shortcut or not? I am posting the definition of my function below :
def searchwithex(path, filen):
global globalFileVal
global globalFileList
global count
dirCounter = checkdir(path) # checks whether the path is accesible or not.
if dirCounter == True:
topList = listdir(path)
for items in topList:
count += 1
if filen == items:
globalFileVal = path +'/' + items
globalFileList.append(globalFileVal)
items = path + '/' + items
if os.path.isdir(items): # checks whether the given element is a #file or a directory.
counter = searchwithex(items, filen)