Moving Files

BlitzMax Forums/BlitzMax Beginners Area/Moving Files

Zenn Lee(Posted 2006) [#1]
Hi, is there a simple function in BlitzMax that allows you to move files to different directories, such as .jpg, .txt, .html.....


H&K(Posted 2006) [#2]
CopyFile( src$,dst$ )
DeleteFile( path$ )

But to be honest Ive never used Copyfile, so jsut take this as a guess


Zenn Lee(Posted 2006) [#3]
Yeah, it dosn't seem to work, but thanks though.


Azathoth(Posted 2006) [#4]
Usually moving files is much faster than copying them if they're on the same drive.


tonyg(Posted 2006) [#5]
Yeah, it dosn't seem to work, but thanks though.


What problem do you get and what code are you running?

CreateFile("MYFILE1")
CopyFile("MYFILE1","../MYFILE2")
Deletefile("MYFILE1")



Yan(Posted 2006) [#6]
@Zenn Lee - Do yourself a favour and update, CopyFile() wasn't available until version 1.20.

If you have already updated and there's some kind of issue with CopyFile(), you can use CopyStream() on two already open streams (that's what CopyFile() does).


Zenn Lee(Posted 2006) [#7]
I think I'm all updated, how can you check?


(tu) ENAY(Posted 2006) [#8]
Click on Help -> About Blitzmax

Should tell you the version number in there.


Zenn Lee(Posted 2006) [#9]
It's funny, when i click on About a window pops up and states "about" and that's it.


SebHoll(Posted 2006) [#10]
You can just do:

RenameFile("C:\Old Folder\My File.txt","C:\New Folder\My File.txt")

This will move My File.txt from Old Folder to New Folder. It had me stumped for a while too...


tonyg(Posted 2006) [#11]
It's funny, when i click on About a window pops up and states "about" and that's it

That was a problem at, I think 1.20.
Upgrade to 1.22 and do a syncmods.


Zenn Lee(Posted 2006) [#12]
Great thanks!!!


Zenn Lee(Posted 2006) [#13]
Hey, though that sorta works, I really need a way to copy files, not move them and delete the fist one. Do you have any ideas, thanks?


tonyg(Posted 2006) [#14]
Oooo!!! I know this one. Use copyfile()


Zenn Lee(Posted 2006) [#15]
Hey, there is no CopyFile(). Every time I try to run code containing CopyFile() the program dies on me. Also I have tried updating many times and it still dosn't work.


tonyg(Posted 2006) [#16]
I'm not making it all up...

Function CopyFile( src$,dst$ )
Description Copy a file.


Check you're on 1.22 and have syncmods.


Zenn Lee(Posted 2006) [#17]
No way would I tust you, Just kidin'. But how can you check what version of BM are you running. I clicked sym. mod. so it should be updated, right, or do you update another way.

Thanks


tonyg(Posted 2006) [#18]
Is it at all possible you're not using the standard IDE?
sym.mod? Never heard of it.
Try 'Help / About BlitzMax' to get the level and then 'Program / Synchronize modules' to synchronise'.


Zenn Lee(Posted 2006) [#19]
OK thanks


Zenn Lee(Posted 2006) [#20]
oh, and yes, I'm standard IDE
I was just being lazy


TomToad(Posted 2006) [#21]
You need to download v1.22 from the Account tab at top and then Product upgrades. First you need to make sure that you have 1.18 or higher installed, then run the 1.22 upgrade. AFter that, do a syncmod to update the mods.


xlsior(Posted 2006) [#22]
No way would I tust you, Just kidin'. But how can you check what version of BM are you running. I clicked sym. mod. so it should be updated, right, or do you update another way.


Syncmods only updates the modules available for your current version of blitzmax. It will *not* automatically upgrade your blitzmax to the next version number.
(there are occasional bugfixes and updates that you'll get through syncmods that will not increase the actual blitzmax version number itself)

you'll need to check this website periodically to see if there is a new release of blitzmax out yet, and manually download/install it, plus do a syncmods afterwards to update your modules as well.


Zenn Lee(Posted 2006) [#23]
oh really I didn't know that

Thanks a ton!!!


Zenn Lee(Posted 2006) [#24]
oh really I didn't know that

Thanks a ton!!!


Zenn Lee(Posted 2006) [#25]
It works, it works, you don't know how much time I spent trying to figure this out. THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!One question though,why doesn't the function copyFile() change to a yellow color when I enter it into the text field.


tonyg(Posted 2006) [#26]
It should do.
Make sure it's listed in docs/bmxmods/commands.txt as
CopyFile( src$,dst$ )|/mod/brl.mod/filesystem.mod/doc/commands.html#CopyFile