revCopyFolder Issue

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

Post Reply
DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

revCopyFolder Issue

Post by DavJans » Tue Sep 05, 2017 11:08 pm

revCopyFolder "\\server\programpath\programfolder", "C:/Programfolder"

works great if "C:/Programfolder" doesnt exist

if it does exist then it still works but it puts the copied folders here:

"C:/ProgramFolder/server/programpath/programfolder/"

Help?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: revCopyFolder Issue

Post by FourthWorld » Wed Sep 06, 2017 12:20 am

What happens when you use a full path for the source folder as you do for the destination folder?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: revCopyFolder Issue

Post by DavJans » Wed Sep 06, 2017 4:45 pm

Im not sure I understand what you mean, as far as I know that is the full path to the files to be copied.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: revCopyFolder Issue

Post by FourthWorld » Wed Sep 06, 2017 5:33 pm

Run this in the message box, selecting the source folder when prompted, and post the result here:

Code: Select all

answer folder "Select your source folder:"; put it
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: revCopyFolder Issue

Post by DavJans » Wed Sep 06, 2017 5:56 pm

//10.0.15.2/qc/Metals Fab tracker


The files to be copied are on a server, are you asking me to map a network drive? if no I can use this

N:/Metals Fab tracker

do you think the / vs. \ is making the difference? im going to try it
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: revCopyFolder Issue

Post by DavJans » Wed Sep 06, 2017 6:16 pm

OK, so im not sure what fixed it. I changed all the \ to /

Also I changed the destination path 1 step back.


revCopyFolder "//server/programpath/programfolder", "C:/"

this works perfect every time.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revCopyFolder Issue

Post by [-hh] » Wed Sep 06, 2017 6:36 pm

Example from the dictionary:
revCopyFolder "E:/Settings","C:/Program Files/My App/Settings"
shiftLock happens

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: revCopyFolder Issue

Post by DavJans » Wed Sep 06, 2017 7:22 pm

Example from the dictionary:
revCopyFolder "E:/Settings","C:/Program Files/My App/Settings"
Thats where I started, from my testing the dictionary is either wrong all together or partially wrong when dealing with network locations in a windows environment or the 30+ computers I have at my office are special :)

This is what works:

revCopyFolder "//ServerLocalIPaddress/Settings","C:/Program Files/My App"

I never tested this:

revCopyFolder "//ServerName/Settings","C:/Program Files/My App"
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: revCopyFolder Issue

Post by bogs » Wed Sep 06, 2017 7:44 pm

DavJans wrote:revCopyFolder "\\server\programpath\programfolder", "C:/Programfolder"
DavJans wrote:OK, so im not sure what fixed it. I changed all the \ to /
I believe in Lc "/" is the default path character to use, for instance in the dictionary entry:
Examples:
revCopyFolder "E:/Settings","C:/Program Files/My App/Settings"
revCopyFolder "data","backups" <- unless specifying folders in the default folder location...
The only other pertinent (although not used in your case) warning was not to use the tilde ~
Note: On Linux and OS X systems, folder paths can contain the tilde (~) character, referring to the current user's home directory. Using these chars is not supported by revCopyFolder, and it is necessary to replace the tilde with its literal value (eg /home/userName)
However, that isn't to say that this was the only or even a major problem, as you pointed out earlier, if the folder was non-existent, it copied it there by creating it. Other factors appear to have been involved.
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: revCopyFolder Issue

Post by [-hh] » Thu Sep 07, 2017 9:13 am

revCopyFolder uses shell (that is on Win: via cmd.exe under NT and else via cmd.com):
  • winSourcePath and winDestPath are original windows pathes (using "\")
  • IF the systemVersion is "NT 6.0" it uses

    Code: Select all

    -- for options see https://ss64.com/nt/robocopy.html
    get shell("robocopy" && winSourcePath && winDestPath && "/E /NFL /NDL /NS /NC /NJH /NJS")
  • ELSE it uses

    Code: Select all

    -- for options see https://ss64.com/nt/xcopy.html
    get shell ("xcopy /I /E /Y /R" && winSourcePath && winDestPath)
So you could use one of the shell commands directly and change the options to your needs.
shiftLock happens

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: revCopyFolder Issue

Post by MaxV » Thu Sep 14, 2017 3:17 pm

from http://livecode.wikia.com/wiki/RevCopyFolder
...
It doesn't work on mobile devices.

On mobile device use this code:

Code: Select all

on copyFolder sFolder, dFolder  #source folder, destination folder
  if char 1 of sFolder is not "/" then
     put the   defaultFolder &"/"& sFolder into sFolder
  end if
  if char 1 of dFolder is not "/" then
     put the  defaultFolder &"/"& dFolder into dFolder
  end if   
  set itemdel to "/"
  put the last item of sFolder into folderName
  create folder dFolder   
  put (dFolder   &"/"& folderName & "/") into dFolder
  create folder dFolder   
  set the defaultFolder to sFolder      
  put the files into FileList
  repeat for each line tLine in FileList
     put URL ("binfile:" & sFolder &"/"& tLine) into URL ("file:" & dFolder &"/"& tLine )
  end repeat
  put the folders into FolderList
  filter FolderList without "."
  filter FolderList without ".."   
  repeat for each line tLine in Folderlist 
     copyFolder tLine, (dFolder)
  end repeat  
end copyFolder
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”