I’m trying run this code on my Ubuntu machine so it will take any new .txt file from the out folder to the in folder, but I'm probably doing something wrong because it does not work.
import shutil
import os
os.chdir("/test/out")
srcdir = os.listdir("/test/out")
dstdir = "/test/in"
srcdir = True
def filemv():
for file in srcdir:
if file.endswith(".txt"):
shutil.move(file, dstdir)
print(file)
while srcdir is True:
filemv()