I have a lot of executables (Win32/Dos) inside one of the folders in my Ubuntu machine. I want to find them all and print out the paths. I tried:
for folder in folders:
print("Searching: " + str(folder))
os.chdir(folder)
for file in glob.glob("**/*.exe", recursive=True):
print(file)
Sadly, this returns no output. What gives?
The folders are under Documents
directory. Running as root is not an issue.
The question is not a duplicate of "how to find all windows executables recursively" rather "why isn't a perfectly correct code that works under Windows misbehaves in linux".
My hunch is the extension .exe isn't really reciprocated in Linux - maybe I should be looking at file header (or similar) to determine file type.
Thanks!