The program takes an optional command line argument (which is meant to be a directory path)
I am using python pathlib and shutil to move files. Here's the code:
from pathlib import Path
path = Path(sys.argv[1])
shutil.move(path / file, path / e.upper())
Where e is just a string representing certain file extension;
Input:
python3 app.py /home/user/Desktop
This code generates an error:
'PosixPath' object has no attribute 'rstrip'
The / operator works fine if I don't specify the second argument in the command line (and use Path.cwd() as the path instead)