SOLVED - How to create a new folder on server using FTP
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
SOLVED - How to create a new folder on server using FTP
I need to auto-create a file folder on a file server (already set up) based on the user's first and last name.
I have already read through the ftp tutorial and got it working - but I need to create the folder first and then upload files to it.
To add, I have the two fields set up - fldFirstName and fldLastName,
I know that the two together woulkd be:
put the text of field "fldLastName" &space & the text of field "fldFirstName" into FullName
However, how do I now create a FOLDER (the name of which will be FullName) on my file server using ftp?
Mike
I have already read through the ftp tutorial and got it working - but I need to create the folder first and then upload files to it.
To add, I have the two fields set up - fldFirstName and fldLastName,
I know that the two together woulkd be:
put the text of field "fldLastName" &space & the text of field "fldFirstName" into FullName
However, how do I now create a FOLDER (the name of which will be FullName) on my file server using ftp?
Mike
Last edited by admin12 on Thu Jul 28, 2011 1:20 pm, edited 1 time in total.
Re: How to create a new folder on server using FTP
Hi Mike,
I don't know which tutorial you are referring to. Does it discuss the libUrlFtpCommand? If not, then please head over to the LiveCode dictionary and read everything about this command.
Usually, you can use the MKD command to create a new directory.
You need to change to the directory where you want to create the new directory. You can use the CWD command for this. On most server, you send the following commands to create a directory in your public directory:
CWD public_html
MKD dirname
Always check the value returned by libUrlFtpCommand for errors before continuing with the next command.
Kind regards,
Mark
I don't know which tutorial you are referring to. Does it discuss the libUrlFtpCommand? If not, then please head over to the LiveCode dictionary and read everything about this command.
Usually, you can use the MKD command to create a new directory.
Code: Select all
get libURLftpCommand("MKD dirname",example.net:75,"root",field "password")
CWD public_html
MKD dirname
Always check the value returned by libUrlFtpCommand for errors before continuing with the next command.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to create a new folder on server using FTP
Mark,
Thanks.
get libURLftpCommand("MKD dirname",example.net:75,"root",field "password")
OK, so if the path is ftp.travelandworkusa.com/public_html/userfiles,"username","password")
That would be
get libURLftpCommand("MKD dirname", ftp.travelandworkusa.com/public_html/userfiles,"username","password")
Now, if I need the dirname to be the user's last and first name, I have already created the following:
put SurName &"_" &FirstName into FullNameTemp
Is that what I put in the dirname? Can I just put the variable FullNameTemp in there, like this:
get libURLftpCommand("MKD " &FullNameTemp, ftp.travelandworkusa.com/public_html/userfiles,"username","password")
Lastly, how do invoke this? Is it automatic (I thought the GET command asks for something and puts it in a variable) or do I need to CALL it somehow?
Seriously, thanks for your help. I am under pressure to get this done.
Mike
Thanks.
get libURLftpCommand("MKD dirname",example.net:75,"root",field "password")
OK, so if the path is ftp.travelandworkusa.com/public_html/userfiles,"username","password")
That would be
get libURLftpCommand("MKD dirname", ftp.travelandworkusa.com/public_html/userfiles,"username","password")
Now, if I need the dirname to be the user's last and first name, I have already created the following:
put SurName &"_" &FirstName into FullNameTemp
Is that what I put in the dirname? Can I just put the variable FullNameTemp in there, like this:
get libURLftpCommand("MKD " &FullNameTemp, ftp.travelandworkusa.com/public_html/userfiles,"username","password")
Lastly, how do invoke this? Is it automatic (I thought the GET command asks for something and puts it in a variable) or do I need to CALL it somehow?
Seriously, thanks for your help. I am under pressure to get this done.
Mike
Re: How to create a new folder on server using FTP
Mike,
The syntax
seems correct, except that you have no obligatory double quotes around the URL.
Do you realise that put and get are commands just like beep and wait? Just give it a try.
Mark
The syntax
Code: Select all
get libURLftpCommand("MKD " &FullNameTemp, ftp.travelandworkusa.com/public_html/userfiles,"username","password")
Do you realise that put and get are commands just like beep and wait? Just give it a try.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to create a new folder on server using FTP
get libURLftpCommand("MKD " &FullNameTemp, "ftp.travelandworkusa.com/public_html/userfiles","username","password")
I also tried the short URL ftp.travelandworkusa.com and then added /public_html/userfiles/ to the FullNameTemp file - did not work either.
Neither created a new directory.
It should have created the following directory:
travelandworkusa.com/public_html/userfiles/Felker_Scotty
Obviously, I changed the username and password to the correct ones and the port will auto default to 21.
I am VERY rusty with my linux commands. I know the mkdir (tried the mkdir command and it did not help at all) command and I thought it was cd.. to go back. However, my brain just cannot seem to handle how to structure this to work.
The files need to go to the following place:
travelandwork.com/public_html/userfiles/NEW DIRECTORY HERE
Now, the database itself is not on this server nor is any websites that will be used, so I am not sure if I even need to back out of the directories.
What am I doing wrong and how can I get it working?
Mike
I also tried the short URL ftp.travelandworkusa.com and then added /public_html/userfiles/ to the FullNameTemp file - did not work either.
Neither created a new directory.
It should have created the following directory:
travelandworkusa.com/public_html/userfiles/Felker_Scotty
Obviously, I changed the username and password to the correct ones and the port will auto default to 21.
I am VERY rusty with my linux commands. I know the mkdir (tried the mkdir command and it did not help at all) command and I thought it was cd.. to go back. However, my brain just cannot seem to handle how to structure this to work.
The files need to go to the following place:
travelandwork.com/public_html/userfiles/NEW DIRECTORY HERE
Now, the database itself is not on this server nor is any websites that will be used, so I am not sure if I even need to back out of the directories.
What am I doing wrong and how can I get it working?
Mike
Re: How to create a new folder on server using FTP
This is so frustrating. I am so closed to finished.
Thanks for the help so far and I hope this one gets solved soon.
Mike
Thanks for the help so far and I hope this one gets solved soon.
Mike
Re: How to create a new folder on server using FTP
Mike,
As I already wrote, libURLftpCommand returns a value. If you post executation errors and values returned by functions and commands right-away, then we can help you more quickly.
I'm also thinking you might try to simply upload a file. If you specify a complete path, the server might create the non-existent folder. This isn't a solution if you want to be able to create empty directories.
Best,
Mark
As I already wrote, libURLftpCommand returns a value. If you post executation errors and values returned by functions and commands right-away, then we can help you more quickly.
I'm also thinking you might try to simply upload a file. If you specify a complete path, the server might create the non-existent folder. This isn't a solution if you want to be able to create empty directories.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to create a new folder on server using FTP
Mark,
I thought about that - I created an empty text file and was thinking about uploading it. Hmmmm.
How do I get the returning value? Using the put? How? I'll try it now.
Here is what I wrote:
put libURLftpCommand("MKDIR " &FullNameTemp, "ftp.travelandworkusa.com","username","password") into FTPme
answer FTPme
I tried it - I get the following error: 500 unknown command
Mike
I thought about that - I created an empty text file and was thinking about uploading it. Hmmmm.
How do I get the returning value? Using the put? How? I'll try it now.
Here is what I wrote:
put libURLftpCommand("MKDIR " &FullNameTemp, "ftp.travelandworkusa.com","username","password") into FTPme
answer FTPme
I tried it - I get the following error: 500 unknown command
Mike
Re: How to create a new folder on server using FTP
SOB.
I changed the MKDIR to MKD like you suggested and it worked.
Hot damn!!!!!!!!
Thank you. This was the MOST annoying hurdle thus far.
Thank you thank you thank you.
Mike
I changed the MKDIR to MKD like you suggested and it worked.
Hot damn!!!!!!!!
Thank you. This was the MOST annoying hurdle thus far.
Thank you thank you thank you.
Mike