I am trying to move the .csv
files from one folder to another once the code is completed. Tried using multiple solutions like shutil.move
and os.replace
and also one of the solutions mentioned in the previous closed posts.
Here is my recent solution:
src = "C:\\Manual Upload\\PY Upload\\CC\\"
dest = "C:\Manual Upload\PY Upload"
for f in Path(src).glob("*.csv"):
shutil.move(os.path.join(src, f), dest)
This copies the file to my destination folder, but does not remove it from source and also gives the following error:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Manual Upload\\PY Upload\\CC\\QA Finance GRM CONS ASPAC_Cost Center_6698_WI4_2021_CC.csv'
I want to delete the .csv
from source and paste it to destination.