i have many .txt files in a directory.At first i want to plot the files one by one on the screen and if it looks fine then i want to copy the .txt file to a directory called "test_folder". If it doesnot looks fine then i donot want to copy the .txt file to the "test_folder" directory.
I tried the below script, however i couldn't do that as i am new to python. I hope experts may help me overcoming this problem.Thanks in advance.
import numpy as np
import os,glob,shutil
import matplotlib.pyplot as plt
os.mkdir('test_folder')
for filex in glob.glob("*.txt"):
print(filex)
data=np.loadtxt(filex)
plt.plot(data)
plt.show()
if plot_looks_nice == "yes":
#copy the filex to the directory "test_folder"
shutil.copy(filex,'test_folder')
elif plot_looks_nice == "no":
#donot copy the filex to the directory "test_folder"
print("not copying files as no option chosen")
else:
print("Please enter yes or no.")