Dec-09-2019, 09:31 AM
Hi
Please try below :-
this code will move newly file from source to destination folder!!
HadoopHelp
Please try below :-
this code will move newly file from source to destination folder!!
import time import os import shutil SECONDS_IN_DAY = 120 #inseconds src = "C:\\Users\Ramesh.kumar\Desktop\SourceData" dst = "C:\\Users\Ramesh.kumar\Desktop\newDataIdentified" Data ="C:\\Users\Ramesh.kumar\Desktop\MoveToLinux" now = time.time() before = now - SECONDS_IN_DAY print("time interval is:",before) def last_mod_time(fname): return os.path.getmtime(fname) for fname in os.listdir(src): src_fname = os.path.join(src, fname) data_fname = os.path.join(Data, fname) if last_mod_time(src_fname) > before: dst_fname = os.path.join(dst, fname) print("-------------------------------------------------------------------------------") print("data is going to from A TO B") print("-------------------------------------------------------------------------------") shutil.copy(src_fname, dst_fname) shutil.move(dst_fname,data_fname) print("-------------------------------------------------------------------------------") print("new data has been moved") print("-------------------------------------------------------------------------------")Thanks
HadoopHelp