moving files

BlitzMax Forums/BlitzMax Beginners Area/moving files

CS_TBL(Posted 2006) [#1]
How do I move a file from one dir to another one?

Not talking about reading a file with readfile() and writing it to a new file again with writefile() .. (=slow) I mean the native way, like how windows (or whatever OS) does it.. the fast way.

If someone has a function (not a method!) suggestion, please in this format:

Movefile sourcefile$,destinationpath$

..with everything local, no globals :P


degac(Posted 2006) [#2]
try looking with the search 'copy file' under Bmax.
There's an example that use *stream* to copy (moving a file is copy it and then - delete it)


kfprimm(Posted 2006) [#3]
RenameFile()?


CS_TBL(Posted 2006) [#4]
degac: isn't moving just simple moving those clusters or sectors or whatever, rather than the physical data?

You can move gigabytes o' files in a splitsecond in windows .. for sure it's not really physically copying and deleting then :P

khomy: will try, tnx


CS_TBL(Posted 2006) [#5]
prime: yay, works!


xlsior(Posted 2006) [#6]
RenameFile()?


But will a rename also allow you to move from one drive to another?


degac(Posted 2006) [#7]
it's new to me too...


CS_TBL(Posted 2006) [#8]
xlsior: tested it .. it works!

(edit) yipes.. from one DRIVE to another DRIVE .. hm.. need to test that yet :P


xlsior(Posted 2006) [#9]
CS_TBL: Just wondering, since a 'rename' under DOS (or windows console) won't move a file across devices...


ImaginaryHuman(Posted 2006) [#10]
I expect that since Max is cross platform, the behavior should be the same on all platforms. If it's only Windows that doesn't allow stuff to go across the device, chances are this has been worked around to provide the window support for moving across devices?