Cannot use revCopyFolder to overwrite folder.

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Cannot use revCopyFolder to overwrite folder.

Post by alex298 » Tue May 26, 2009 4:11 am

Hi,

I have problem to use revCopyFolder to overwrite old folder in the application default folder?

Here's my problem:

There are two folders (game and score) in the application default folder. There is also another folder (animal) inside the score folder. I wish to copy the animal folder (score/animal) to overwrite the game folder.

When I use the codes below, a new folder with the name game2 will be copy to the application default folder
revCopyFolder "score/animal, "game2"
Actually I wish to copy the folder and all it's content from score/animal to over-write the game folder. I tried to use the codes below:
revCopyFolder "score/animal, "game"
However a new folder with the name animal will be copy under the game folder, not over-write the game folder.

I also tried:
revCopyFolder "score/animal, ""
But it doesn't work.

Please help.

Thanks and best regards
Alex
Nice to meet all of you.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Tue May 26, 2009 12:05 pm

Alex,
why dont you delete the old folder first and then do the revcopyfolder?
If revcopyfolder finds a folder with the same name at the destination then it changes the name automatically like in your case game2.
Actually copying a folder should not automatically replace an existing folder. That is not copying but replacing.
In an other setting you could test for the existence of a folder of the same name in the destination directory (if there is a folder "a/Folder/") and then delete that folder and then do revcopyfolder.
Is that what you mean?
regards
Bernd

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Thu May 28, 2009 2:16 pm

Dear Bernd,

Thanks for your help.
why dont you delete the old folder first and then do the revcopyfolder?
Actually my first idea is also delete the old folder and then do the revcopyFolder. However after some time, it comes to my thought that this should be much easier if the revCopyFolder can overwrite the old folder - only one step.

Thanks and best regards
Alex
Nice to meet all of you.

jsims
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 25
Joined: Thu Apr 30, 2009 1:45 pm
Contact:

Post by jsims » Fri May 29, 2009 3:11 pm

Hi Alex,

While I agree that 1 step would be more efficient, I would be concerned about the unintended consequences of revCopyFolder automatically replacing an existing folder.

If we want to be able to do such in one step, I would recommend a feature request for something like revReplaceFolder or revOverwriteFolder. That way, as a coder, I have the understanding that what I'm doing could be overwriting an existing folder. If the folder specified to overwrite doesn't exist, then this function would just do a normal copy.

Just my 2 cents.
- John

Post Reply