I would like to know how I can with pyhton list all the files in a folder that contains a specific file so that if that file is moved to another folder I list the files of the new folder where it is located. Thanks!
I would like to know how I can with pyhton list all the files in a folder that contains a specific file so that if that file is moved to another folder I list the files of the new folder where it is located. Thanks!
import os
scanned = 0
infected = "prueba.txt"
#Busca en todas los directorios de "C:/" el archivo "prueba.txt"
y cuando lo encuentra hace un print del directorio del archivo
for root, dirs, files in os.walk('C:/'):
scanned = scanned + 1
for file in files:
if infected in file:
print((root + "/" + file))
print("Archivos total escaneados: " + str(scanned))