renaming a file

Blitz3D Forums/Blitz3D Beginners Area/renaming a file

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

A bit ugly but this seems to work. It uses the DOS ren command:

REN drive:\folder\filename.ext newfilename.ext

oldfilename$="temp.txt"
newfilename$="BlitzPower!!.txt"

q$=Chr$(34)
ExecFile "cmd /c ren "+q$+CurrentDir$()+oldfilename$+q$+" "+q$+newfilename$+q$

If FileType(newfilename$) Print "Renamed!"

a$=Input$("Done ..")
End

NB: The above is from WinXP
Not tested on Win98 but I think you need
ExecFile "command /c ren "+q$+CurrentDir$()+oldfilename$+q$+" "+q$+newfilename$+q$