MoveFile(SourceFile$, DestinationFile$) & more file comm

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

MoveFile(SourceFile$, DestinationFile$) & more file comm

Post 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?
Last edited by AND51 on Wed Nov 22, 2006 4:24 pm, edited 1 time in total.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Re: MoveFile(SourceFile$, DestinationFile$)

Post 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
Last edited by Dummy on Tue Nov 21, 2006 9:40 pm, edited 1 time in total.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Sure renamefile works on different drives too!
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

Macro MoveFile(Source,Dest)
MoveFile_(Source,Dest)
EndMacro

:D
Tranquil
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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).
PB 4.30

Code: Select all

onErrorGoto(?Fred)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Macro MoveFile(Source,Dest)
renamefile(Source,Dest)
EndMacro

:lol:
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Better. :lol:
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

You should have searched. A search for MoveFile gives you the answer.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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.
Last edited by thefool on Tue Nov 21, 2006 9:40 pm, edited 1 time in total.
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

thefool wrote:Sure renamefile works on different drives too!
Really?

lol didn't know that :oops:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

ok :)
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: MoveFile(SourceFile$, DestinationFile$)

Post by nco2k »

[OFFTOPIC]
Dummy wrote:Yes make DeleteFile() take the flag #PB_FileSystem_Force
yes and #PB_FileSystem_EmptyOnly flag for DeleteDirectory(). :P
[/OFFTOPIC]

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Absolutely @ nco2k

By the way, I edited the title of this topic, now you can post all of you file-library-wishes! :D
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

RenameFile(): extended description + example about moving files added to the manual now.... :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply