Python script to extract file Creation dates
| July 8th, 2017Extract dates to CSV file
#!/usr/bin/env python import os, csv, sys, subprocess, hashlib, time, pytz from datetime import timedelta, datetime, tzinfo import pytz import tzlocal writer = csv.writer(sys.stdout, quoting=csv.QUOTE_ALL) il = pytz.timezone('Israel') local_timezone = tzlocal.get_localzone() # get pytz timezone with open('file.csv', 'w', newline='', encoding='utf-8') as csvfile: spamwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) for directory, subdirectories, filenames in os.walk('PATH'): unix_timestampc = float(os.path.getctime(directory)) unix_timestamp = float(os.path.getmtime(directory)) spamwriter.writerow([directory,unix_timestampc,unix_timestamp]) for filename in filenames: #h = hashlib.md5()//if has is needed full_filename = os.path.join(directory, filename) unix_timestampc = float(os.path.getctime(full_filename)) unix_timestamp = float(os.path.getmtime(full_filename)) spamwriter.writerow([directory+"\\"+filename,unix_timestampc,unix_timestamp])