import numpy as np
import os
import matplotlib.pyplot as plt
# Loading Data
Srcpath ='/mnt/SrcFolder'
Destpath='/mnt/DestFolder'
traces= os.listdir(path)
with open(File_Sensitive_Value, 'wb') as fp:
for trace in traces:
Plaintext = Extract_Plaintext(trace)
print(Plaintext)
Ciphertext= Extract_Ciphertext(trace)
Key= Extract_Key(trace)
print(Key)
filepath = os.path.join(path, trace)
dataArray= np.load(filepath)
// sbox is function that have used to have the correct Sensitive value.
Sensitive_Value = (sbox[int(Plaintext[0:2],16) ^ int(Key[0:2],16)])
print ("Plaintext=", int(Plaintext[0:2],16))
print("Key=", int(Key[0:2],16))
print ("Sensitive_Value=", Sensitive_Value)
os.rename(os.path.join(path,trace), os.path.join(path_Sensitive_Value, trace[:-4]+'_'+'SenVal='+str('{:03}'.format(Sensitive_Value))+'.npy'))
After finding the new name of each file in my Src folder, I need to copy each file with its new name in the destfolder, od course with giving the original name of each file in the Src Folder. My solution, code lets me to delecte all the original files. How to resole this problem pleasee?