revMoveFolder (solved)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

revMoveFolder (solved)

Post by Da_Elf » Sat May 03, 2014 5:51 am

I did a forum search and didnt come up with anything on this. i must be missing something here. I created a small card with 1 button on it with this code

Code: Select all

on mouseUp
   revMoveFolder "folder","D:/"
end mouseUp
the app was in a folder containing a folder called "folder" containing a demo .txt file.
it should have moved the folder and its contents to the D:/ drive but it doesnt do anything

not sure if this makes a difference but its livecode 6.5.0 on windows7 and yes there is a d:/ drive.
Last edited by Da_Elf on Sat May 03, 2014 8:01 pm, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: revMoveFolder

Post by Simon » Sat May 03, 2014 6:15 am

Hi Da_Elf,
is "folder" in the default folder?
With just what you have there and nothing else the default folder is where the stack is (best to save the stack somewhere you know or the default folder will be deep in (x86) Program Files).

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: revMoveFolder

Post by Da_Elf » Sat May 03, 2014 6:48 am

my folders are like this

g:\test\untitled.exe
g:\test\folder\
g:\test\folder\test.txt

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: revMoveFolder

Post by FourthWorld » Sat May 03, 2014 7:00 am

I believe you'll need to specify the full path for the desintation, and you may also want to use a full path for the source as well so you needn't keep track of the default folder.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: revMoveFolder

Post by Da_Elf » Sat May 03, 2014 3:59 pm

i slept on it and came back with this this morning. but it still doesnt work
im getting the absolute path to the folder. and D:\ is the absolute path to where i want it moved to but it still isnt moving the folder

Code: Select all

on mouseUp
   answer folder "Please choose your media folder destination"
   put it into fVar
   put the effective filename of this stack into tPath
   set the itemDelimiter to slash
   delete last item of tPath
   put tPath & slash & "media" & slash into tImediaFolder
   revMoveFolder tImediaFolder,fVar
   answer tImediaFolder & " moved to " & fVar
end mouseUp


dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: revMoveFolder

Post by dave.kilroy » Sat May 03, 2014 4:38 pm

Hi Da-Elf

What debugging have you tried? The dictionary says that the actual work of moving is done by AppleScript or Shell (depending on platform obviously) and errors are put in the result function. I note in the script you posted that you aren't using this function (maybe you are and you just posted a simpler version of your real code) - if not then maybe try something like the following just after calling revMoveFolder:

Code: Select all

put the result into tResult
answer tResult
Also, again just in case you are not actually calling revMoveFolder from a mouseUp, please note that i don't think you can call it too early (certainly after preOpenStack) in the start up sequence.

There are other things you could try such as: what platform and version of LC you are using, have you checked for LC bugs agains those versions, have tried the functionality with brand new test stacks, have you tried with different locations, with different OS's, with different versions of LC, with different files? - um that's all I can think of - good luck!

Dave
"...this is not the code you are looking for..."

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: revMoveFolder

Post by Da_Elf » Sat May 03, 2014 4:42 pm

i added the result thing you said and the result was "1" no clue what that means

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: revMoveFolder

Post by dave.kilroy » Sat May 03, 2014 5:01 pm

Aha! Well LiveCode error number 1 is "Handler: running low on memory, script aborted" - does that give you any clues?

There are quite a few ways to find out what cryptic error numbers are - this is one of them http://livecodeshare.runrev.com/stack/7 ... ror-Lookup
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: revMoveFolder

Post by dave.kilroy » Sat May 03, 2014 5:16 pm

actually I showed you a sloppy way to use the result - this is better:

Code: Select all

if the result is not empty then
    answer the result
end if
Richard has written a great piece on LiveCode errors: http://livecodejournal.com/tutorials/ha ... s-001.html in it he shows (among other things) how to turn cryptic error numbers in to something easier to understand
"...this is not the code you are looking for..."

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: revMoveFolder

Post by Da_Elf » Sat May 03, 2014 5:31 pm

hmm my last post didnt seem to post. The thing about low on memory doesnt make sense sense since there is more than enough room n my drives. "rename folder" works for moving the folder however only if its on the same drive. What recommendations would you have to move a folder from one drive to another drive?

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: revMoveFolder

Post by dave.kilroy » Sat May 03, 2014 5:50 pm

Sorry I don't think I'll be much use to you from now on (but somebody from the LiveCode community will). I don't think I've ever moved folders with LiveCode - I usually check for the existence of a folder/file, create it if it's not there and then recursively copy across any files needed.

Actually regarding you remark about memory - I took it that it was referring to RAM rather than space on your drive!
"...this is not the code you are looking for..."

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: revMoveFolder

Post by jacque » Sat May 03, 2014 6:17 pm

Da_Elf wrote:The thing about low on memory doesnt make sense sense since there is more than enough room n my drives. "rename folder" works for moving the folder however only if its on the same drive. What recommendations would you have to move a folder from one drive to another drive?
Memory and disk space are different things, of course. If LC is running out of RAM then use Dave's suggestion of recursively copying files, then deleting the originals. To see if RAM really is the problem, try moving a folder with only a single small text file in it. If that works, then RAM is the problem.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: revMoveFolder (Solved)

Post by Da_Elf » Sat May 03, 2014 7:31 pm

i tried with a single file and i tried with the full folder ive tried with no subfolders in the folder to be moved and with subfolders. The revMoveFolder is using absolute paths as found with the "answer folder" and the "effective filename". Ive tried moving to the D:/ drive and to the same volume as the original path but nothing worked. Ive got 32gigs of ram since im a 3d animator and i popped open task manager and monitored my ram usage when clicking the button to move and it didnt flinch. While looking into the whole thing on copying the files over to do the recursive method i decided to use the revCopyfolder and low and behold it worked. But when i tried deleting the original folder it wouldnt delete it. This leads me to believe it might be a permissions thing and thats why it didnt want to move but tried running as administrator but didnt work


EDIT... i got it to work using revDeleteFolder since i noticed delete folder wont work if its got stuff in it. Thanks for all of the help guys

Code: Select all

on mouseUp
   answer folder "Please choose your destination folder"
   put it into fVar
   put the effective filename of this stack into tPath
   set the itemDelimiter to slash
   delete last item of tPath
   put tPath & slash & "media" & slash into tImediaFolder
   revCopyFolder tImediaFolder,fVar
   revDeleteFolder tImediaFolder
   answer tImediaFolder & " moved to " & fVar
end mouseUp
Last edited by Da_Elf on Sat May 03, 2014 8:00 pm, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: revMoveFolder

Post by FourthWorld » Sat May 03, 2014 7:51 pm

If you can make a simple example stack that fails when moving from one user-writable space to another, please test this under v6.6.2 RC3 and if the problem persists please include the sample stack in a bug report:
http://quality.runrev.com/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: revMoveFolder (solved)

Post by Da_Elf » Sun May 04, 2014 10:53 am

i dont see that version

Post Reply