Python to archive files
Module to import
First, let’s impor os, glob and shutil
- os, to get the path of the files and to create the folder “archive” if not present
- glob to select all the txt files
- shutil to move the files in the dir “archive”
Iteration
With the for (each) loop we move each file in archive.
try except
If there is no folder “archive”, it is created