Page 1 of 2
MoveFile(SourceFile$, DestinationFile$) & more file comm
Posted: Tue Nov 21, 2006 8:38 pm
by AND51
Hello!
can you add the command MoveFile() to PB 4? It's annoying to copy+delete the files or to use API.
Adavntage of moving instead of copying and deleting: Imagine, you have got only 1 GB free on your disk or 1 MB on your floppy disk. How do you want to move a 2 Gb file (or 2 MB file) then? You cannot copy, becasue the file is larger than the rémaining free disk space...
And perhaps it would be good to add optional flags to DeleteFile(), so that you can delete read-only files?
What do you think?
Re: MoveFile(SourceFile$, DestinationFile$)
Posted: Tue Nov 21, 2006 9:09 pm
by Dummy
AND51 wrote:Hello!
can you add the command MoveFile() to PB 4? It's annoying to copy+delete the files or to use API.
Adavntage of moving instead of copying and deleting: Imagine, you have got only 1 GB free on your disk or 1 MB on your floppy disk. How do you want to move a 2 Gb file (or 2 MB file) then? You cannot copy, becasue the file is larger than the rémaining free disk space...
And perhaps it would be good to add optional flags to DeleteFile(), so that you can delete read-only files?
What do you think?
For the first thing you mentioned:
use RenameFile().
as long as you are operating on the same drive it works with RenameFile()
Yes make DeleteFile() take the flag #PB_FileSystem_Force
Posted: Tue Nov 21, 2006 9:11 pm
by thefool
Sure renamefile works on different drives too!
Posted: Tue Nov 21, 2006 9:12 pm
by Tranquil
Macro MoveFile(Source,Dest)
MoveFile_(Source,Dest)
EndMacro

Posted: Tue Nov 21, 2006 9:14 pm
by AND51
I didn't know that; I will test it ASAP. If it would be in the help, that renaming a file makes the file moving, I wouldn't have asked.
Danke Tranquil, aber du benutzt API, das geht auf anderen OS nicht (auch, wenn ich eh nur Windows benutze).
Posted: Tue Nov 21, 2006 9:20 pm
by thefool
Macro MoveFile(Source,Dest)
renamefile(Source,Dest)
EndMacro

Posted: Tue Nov 21, 2006 9:33 pm
by AND51
Better.

Posted: Tue Nov 21, 2006 9:34 pm
by Trond
You should have searched. A search for MoveFile gives you the answer.
Posted: Tue Nov 21, 2006 9:39 pm
by thefool
Trond wrote:You should have searched. A search for MoveFile gives you the answer.
This is no excuse for it not being in the manual where it belongs!
And the second request is good enough.
Posted: Tue Nov 21, 2006 9:39 pm
by Dummy
thefool wrote:Sure renamefile works on different drives too!
Really?
lol didn't know that

Posted: Tue Nov 21, 2006 10:07 pm
by Trond
thefool wrote:Trond wrote:You should have searched. A search for MoveFile gives you the answer.
This is no excuse for it not being in the manual where it belongs!
And the second request is good enough.
Linux is worse - there's no command line command to rename a file!
Also this was already requested, no need for a new thread:
http://www.purebasic.fr/english/viewtop ... t=movefile
Posted: Tue Nov 21, 2006 10:17 pm
by thefool
ok

Re: MoveFile(SourceFile$, DestinationFile$)
Posted: Tue Nov 21, 2006 10:40 pm
by nco2k
[OFFTOPIC]
Dummy wrote:Yes make DeleteFile() take the flag #PB_FileSystem_Force
yes and #PB_FileSystem_EmptyOnly flag for DeleteDirectory().
[/OFFTOPIC]
c ya,
nco2k
Posted: Wed Nov 22, 2006 4:25 pm
by AND51
Absolutely @ nco2k
By the way, I edited the title of this topic, now you can post all of you file-library-wishes!

Posted: Wed Nov 22, 2006 4:58 pm
by Andre
RenameFile(): extended description + example about moving files added to the manual now....
