I need to move files from one folder to another based on a given condition. The condition is that if a certain file has more than or equal to 100 rows (for example), it will be moved to another folder.
I've tried different versions of shutil however, I have been unsuccessful with moving any files at all.
src = 'path1'
dest = 'path2'
for files in src.glob('*.csv'):
df = pd.read_csv(files)
if len(df) >= 100:
shutil.move(src, os.path.join(dest, files))
or
src = 'path1'
dest = 'path2'
for files in src.glob('*.csv'):
if len(files) >= 100:
shutil.move(src, os.path.join(dest, files))
I would like to know why it's not working at all. It seems pretty much straightforward with the shutil command.
Updated the code above from the comments. All still don't work at all.
** Funny I get down points for an honest question. I'm new to python and I'm struggling to code. This isn't a nice community as far as my experience.