Using revCopyFile from server to laptop
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
Using revCopyFile from server to laptop
Greetings All,
I am trying to write a script that will sync a text file from our company's server to a laptop.
I want to keep the creation date, last modified date and the last accessed date intact.
-- fileXX = location of file on server
-- fileYY = location of folder on laptop
If I use "put URL("File:" & fileXX) into URL("File:" & fileYY & "/" & filename)" the file is copied correctly, but I lose the attributes I want.
However, if I use "revCopyFile fileXX,fileYY nothing is copied and I get error = 1 in the result.
Using the revCopyFile command to copy a file from one place to another on the laptop works fine.
Does anyone know if there is a problem using the revCopyFile command to copy from a server?
Thanks for your help.
John Miller
I am trying to write a script that will sync a text file from our company's server to a laptop.
I want to keep the creation date, last modified date and the last accessed date intact.
-- fileXX = location of file on server
-- fileYY = location of folder on laptop
If I use "put URL("File:" & fileXX) into URL("File:" & fileYY & "/" & filename)" the file is copied correctly, but I lose the attributes I want.
However, if I use "revCopyFile fileXX,fileYY nothing is copied and I get error = 1 in the result.
Using the revCopyFile command to copy a file from one place to another on the laptop works fine.
Does anyone know if there is a problem using the revCopyFile command to copy from a server?
Thanks for your help.
John Miller
Re: Using revCopyFile from server to laptop
Hi John,
Just checking... when you say "server" do you mean something like http://www.misite.com or do you mean a local server?
Reading in the dictionary there is no reference in the "Notes" section that says revCopyFile uses the internet library which implies that you can not use it for http requests.
Other then that use absolute path always.
Simon
Just checking... when you say "server" do you mean something like http://www.misite.com or do you mean a local server?
Reading in the dictionary there is no reference in the "Notes" section that says revCopyFile uses the internet library which implies that you can not use it for http requests.
Other then that use absolute path always.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
Re: Using revCopyFile from server to laptop
Simon,
Thanks for responding. I am not familiar with the terminology you are using, but the server is a dedicated machine in our company's office. It holds all our database files, etc.
The address I am using to access it is ("//Server/ke estimator folder/" & textfilename.txt"
This address works when I open my text files, but doesn't seem to work with the revCopyFile command.
John
Thanks for responding. I am not familiar with the terminology you are using, but the server is a dedicated machine in our company's office. It holds all our database files, etc.
The address I am using to access it is ("//Server/ke estimator folder/" & textfilename.txt"
This address works when I open my text files, but doesn't seem to work with the revCopyFile command.
John
Re: Using revCopyFile from server to laptop
Hi John,
I'm not completely sure but it may be the spaces in the folder name.
First thing to try is making a folder and file on your server without spaces in the name.
If that works then urlEncode (see in the dictionary) your server path to replace spaces with "+"
I think there are some faults with revCopy and you may have to use "put URL". If that is the case on Windows you can set the attributes after you have downloaded the files using "getshell("attrib +R +A pathToFile")" where +R is read only and +A is archive (google Windows cmd for full descriptions) and pathToFile is the path to the downloaded file.
Simon
I'm not completely sure but it may be the spaces in the folder name.
First thing to try is making a folder and file on your server without spaces in the name.
If that works then urlEncode (see in the dictionary) your server path to replace spaces with "+"
I think there are some faults with revCopy and you may have to use "put URL". If that is the case on Windows you can set the attributes after you have downloaded the files using "getshell("attrib +R +A pathToFile")" where +R is read only and +A is archive (google Windows cmd for full descriptions) and pathToFile is the path to the downloaded file.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
Re: Using revCopyFile from server to laptop
Simon,
Thanks for the suggestions. I'll give it a try later today and let you know how it went.
John
Thanks for the suggestions. I'll give it a try later today and let you know how it went.
John
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
Re: Using revCopyFile from server to laptop
Simon,
Good News !!! I tried using the URLencode for the file location on the server, like you suggested. That DIDN'T work, but your comment got me thinking.
Usually, live code doesn't discriminate between foward slashes and back slashes in a file address. This keeps things simple between Mac and Windows programs.
On a windows machine, using the forward slash works fine when using revCopyFile to copy a file from one location to another on the same machine. However, the same practice does NOT work when copying a file from a server.
On our server, the address has to use back slashes. So here is my new script.
put the serverfileLoc into fileAA
replace "/" with "\" in fileAA
put folderDestinationLoc into folderBB
revCopyFile fileAA,folderBB
Well, I got revCopyFile to work, but after all this, I found that the modification of my files is changed when the copy is made, which I didn't want.
So, to accomplish my goal, it is much faster to use -- put URL("File:" & fileToCopy) into URL("File:" & folderBB & "/" & filename)
Ah, so goes my life in programming!!!
Simon, thanks for your help in figuring this out.
John
Good News !!! I tried using the URLencode for the file location on the server, like you suggested. That DIDN'T work, but your comment got me thinking.
Usually, live code doesn't discriminate between foward slashes and back slashes in a file address. This keeps things simple between Mac and Windows programs.
On a windows machine, using the forward slash works fine when using revCopyFile to copy a file from one location to another on the same machine. However, the same practice does NOT work when copying a file from a server.
On our server, the address has to use back slashes. So here is my new script.
put the serverfileLoc into fileAA
replace "/" with "\" in fileAA
put folderDestinationLoc into folderBB
revCopyFile fileAA,folderBB
Well, I got revCopyFile to work, but after all this, I found that the modification of my files is changed when the copy is made, which I didn't want.
So, to accomplish my goal, it is much faster to use -- put URL("File:" & fileToCopy) into URL("File:" & folderBB & "/" & filename)
Ah, so goes my life in programming!!!
Simon, thanks for your help in figuring this out.
John