I'm trying to rename the file names and extensions of all the files in a directory and move them to a new directory. I've read multiple post on how to do it but for some reason I haven't been successful and I've been stuck on this for 3 days now and feel like I'm doing something careless. Somebody get me on track please. This is the latest way I've been trying.
import os
previousName = 'Macintosh HD/Users/kunductor/Desktop/folder3/windeffect.asd'
newName = 'Macintosh HD/Users/kunductor/Desktop/folder4/wind.wav'
os.rename(previousName,newName)
When I run the code above I get the message:
Traceback (most recent call last):
File "rename.py", line 7, in <module>
os.rename(previousName,newName)
FileNotFoundError: [Errno 2] No such file or directory
If it matters, I'm using macOS Mojave, version 10.14.2.