For better hexvalue print out

master
Jason Zhu 2021-08-15 15:55:29 +10:00
parent 906aae5ba5
commit d1f0d47fdf
1 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import argparse
from typing import List from typing import List
import pandas as pd import pandas as pd
import hashlib import hashlib
from datetime import datetime
import csv import csv
from pandas.core.series import Series from pandas.core.series import Series
@ -33,7 +34,9 @@ def get_file_checksum(p: pathlib.Path):
with open(p, 'rb') as f: with open(p, 'rb') as f:
while chunk := f.read(8192): while chunk := f.read(8192):
m.update(chunk) m.update(chunk)
return m.hexdigest() hexvalue = m.hexdigest()
print(hexvalue)
return hexvalue
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='convert hardlink to symlink in download folder') parser = argparse.ArgumentParser(description='convert hardlink to symlink in download folder')
@ -81,8 +84,8 @@ if __name__ == "__main__":
csv_path = "result.csv" csv_path = "result.csv"
df_csv = pd.DataFrame(columns=['FileName', 'Path', 'inode', 'NumberOfLinks', 'CheckSum']) df_csv = pd.DataFrame(columns=['FileName', 'Path', 'inode', 'NumberOfLinks', 'CheckSum'])
for x in paths: for x in paths:
print(str(x))
if x.lstat().st_size > min_file_size * 1024 * 1024: if x.lstat().st_size > min_file_size * 1024 * 1024:
print(str(datetime.now()) + " : " + str(x))
new_row = {'FileName': x.name, new_row = {'FileName': x.name,
'Path': str(x), 'Path': str(x),
'inode': x.lstat().st_ino, 'inode': x.lstat().st_ino,