I have a script that should rename the file default.xex to the value of FileName[:-1] which is the name of the directory the xex file is in. The code I have is:
`
# This renames default.xex to the correct FileName.xex
for filename in DirectoryList:
path = HomePath + UnpackedPath + FileName + FileName + FileName + FileName
filename = FileName[:-1] + "\\default.xex"
src = filename
dst = FileName[:-1] + ".xex"
os.rename(os.path.join(path, src), os.path.join(path, dst))
`
however this always throws an error showing \FileName.xex when \FileName.xex is expected. The error is:
Exception has occurred: FileNotFoundError [Errno 2] No such file or directory: '/home/corey/XBLA_Unpacked/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon\default.xex' -> '/home/corey/XBLA_Unpacked/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon/FarCry 3 Blood Dragon.xex'
This renames default.xex to the correct FileName.xex
for filename in DirectoryList:
path = HomePath + UnpackedPath + FileName + FileName + FileName + FileName
filename = FileName[:-1] + "\\default.xex"
src = filename
dst = FileName[:-1] + ".xex"
os.rename(os.path.join(path, src), os.path.join(path, dst))
Edit: I just realized this only shows 1 , however on my screen in VS Code and in this text editor it shows 2
the original xex file is FarCry 3 Blood Dragon\default.xex.
I have tried every solution I could find while googling and looking at other people's solutions on here and nothing seems to work. I tried setting it as a specific string variable and running it that way and it still resulted in \.