Using python, need to look into a dir and grab a filename, then insert the name into a MSSQL database with date/time for tracking purposes.
Web Results I keep coming across are for loading a whole CSV which we have in place and is already working for us. This need is just simply to pull the filename and add to a tracking table in MSSQL.
Here is the code that simply reads the files:
# read file
path = "Y:\\python\\working"
dirs = os.listdir( path )
# This prints all the files and directories (in our case it will be one file)
for file in dirs:
print (file)
How can I take the result (filename) and insert filename and current date into a MSSQL DB with say a table name of "tracking" and two cols, file_name & date? There will be only 1 file at a time.