put url tricks to copy files on windows
Mike Kerner
MikeKerner at roadrunner.com
Tue Jun 20 17:38:25 EDT 2017
In case it helps, here's the entire routine. This works on a Mac.
on copyFilesNFolders fromFolder toFolder
if there is not a folder toFolder then
create folder toFolder
if the result is not empty then
put the result into theResult
errlog theResult
quit
end if #the result is not empty
end if #there is not a folder toFolder
put folders(fromFolder) into folderList
#<walk the folders recursively>
repeat for each line folderName in folderList
if char 1 of folderName is "." then next repeat
copyFilesNFolders (fromFolder&slash&folderName),
(toFolder&slash&folderName)
end repeat #for each line folderName in folderList
#</walk the folders recursively>
#<now we're a the bottom for this folder. Copy the folder and then the
files in the folder>
put the defaultFolder into theDefaultFolder
set the defaultFolder to fromFolder
put the files into theFiles
repeat for each line theFile in theFiles
if char 1 of theFile is "." then next repeat #skip all the invisible
files like .DS_STORE
put fromFolder&slash&theFile into fromFile
put toFolder&slash&theFile into toFile
if there is not a file toFile then
put url ("binfile://" &fromFile) into url ("binfile://" &toFile)
if the result is not empty then
put the result into theResult
errlog theResult
breakpoint
quit
end if #the result is not empty
end if #there is not a file toFile
end repeat #for each line theFile in theFiles
set the defaultFolder to theDefaultFolder
#</now we're a the bottom for this folder. Copy the folder and then the
files in the folder>
end copyFilesNFolders
On Tue, Jun 20, 2017 at 5:34 PM, Mike Kerner <MikeKerner at roadrunner.com>
wrote:
> I'm trying to use the put url technique to copy files on windows, but I'm
> getting "can't open file"
> If I do something like
> answer line 1 of url ("binfile://"&filename)
> I get what I expect, but when I try to
> put url ("binfile://"&filename) into url ("binfile://"&toFilename)
> I get "can't open file" in the result
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
> and did a little diving.
> And God said, "This is good."
>
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
More information about the use-livecode
mailing list