Page 1 of 1
revCopyFile
Posted: Tue Jan 29, 2013 9:58 pm
by lohill
My application accesses a sqlLite database and I'd like to give the user a chance to make a copy of the database they are connected to and then to reconnect to that cloned database. This is all to be done in the default directory. I have tried 'revCopyFile fileA, fileB' but the result shows Execution Error. There is a resulting new file but it has nothing in it. I have also tried 'put URL fileA into URL fileB' with no luck. As I read the Dictionary comments there is an old one about requiring an absolute path that just brought up a second question. How is that determined?
Any help on either revCopyFile or absolute path will be appreciated.
Thanks,
Larry
Re: revCopyFile
Posted: Tue Jan 29, 2013 10:53 pm
by Simon
Hi Larry,
You probably already know this but:
Code: Select all
put the effective filename of this stack into tPath
set the itemDelimiter to slash
delete last item of tPath
put fileA into url("binfile:" & tPAth & "/fileB")
Will put the file in the same folder as the stack. You can use any of the specialFoderPath as well.
Simon
Re: revCopyFile
Posted: Wed Jan 30, 2013 12:28 am
by lohill
Thanks Simon,
That took care of the path part but the file that was created was empty rather than a clone. I guess I'll just have to tell my user to go to the Finder, copy and paste with the desired name.
Larry
Re: revCopyFile
Posted: Wed Jan 30, 2013 12:44 am
by Simon
Hi Larry,
I've copied files lots of times without trouble.
Maybe I didn't use enough words:
Code: Select all
put the effective filename of this stack into tPath
set the itemDelimiter to slash
delete last item of tPath
put url "http://www.mysite.com/database.sql"into url("binfile:" & tPAth & "/database.sql")
Does that help?
For larger files:
Code: Select all
put the effective filename of this stack into tPath
set the itemDelimiter to slash
delete last item of tPath
libURLDownloadToFile "http://www.mysite.com/database.sql", tPAth & "/database.sql"
Simon