Page 1 of 1

revCopyFolder Issue

Posted: Tue Sep 05, 2017 11:08 pm
by DavJans
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?

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 12:20 am
by FourthWorld
What happens when you use a full path for the source folder as you do for the destination folder?

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 4:45 pm
by DavJans
Im not sure I understand what you mean, as far as I know that is the full path to the files to be copied.

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 5:33 pm
by FourthWorld
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

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 5:56 pm
by DavJans
//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

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 6:16 pm
by DavJans
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.

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 6:36 pm
by [-hh]
Example from the dictionary:
revCopyFolder "E:/Settings","C:/Program Files/My App/Settings"

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 7:22 pm
by DavJans
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"

Re: revCopyFolder Issue

Posted: Wed Sep 06, 2017 7:44 pm
by bogs
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.

Re: revCopyFolder Issue

Posted: Thu Sep 07, 2017 9:13 am
by [-hh]
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.

Re: revCopyFolder Issue

Posted: Thu Sep 14, 2017 3:17 pm
by MaxV
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