Dumb question about files on a server
Graham Samuel
livfoss at mac.com
Mon Sep 19 10:40:52 EDT 2016
I have some server space and a domain name, let’s say ‘mysite.com <http://mysite.com/>’. On this host I have a web site (www.mysite.com <http://www.mysite.com/>), plus LiveCode Server (8.1 commercial as it happens) and some scripts etc. So far, so good. Now I want to write a script that runs on the server and does the following - this is not code, but is supposed to show what I want to code:
1. If there is not a folder within my space called ‘myUsefulData’, then create such a folder;
2. If there is not a text file ‘myCurrentData.txt’ within the above folder, then create one (this may not be necessary, as an attempt to access the file might create it?);
3. Read the contents of the file into a variable;
4. Add some data from within the program (let’s say an extra line at the end);
5. Rewrite the updated file.
There may also be error checking etc.
Although this seems extremely simple, I find I don’t know how to do it, and so far the LC examples I’ve read don’t seem to help. I am not sure for example if FTP comes into the equation (I think it does) or the user name and password I need for FTP access from outside the server (surely not?), or indeed what the path to my own bit of the server actually is. Of course I’ve tried stuff, but nothing has worked so far, and a test script (running in the IDE, not within a server script) fails silently. Nothing is created, nothing is destroyed, but sadly everything isn’t transformed.
Can anyone explain how to do this, or at least point me to an explanation.
Sorry for the dumb question, but there it is.
Graham
More information about the use-livecode
mailing list