View script | License | Download script | History | Other scripts by: notchent |
2-May 23:54 UTC
[0.062] 12.444k
[0.062] 12.444k
Archive version of: ftp-tool.r ... version: 1 ... notchent 29-Aug-2009Amendment note: new script || Publicly available? Yes REBOL [ File: %ftp-tool.r Date: 30-Aug-2009 Title: "FTP Tool" Author: Nick Antonaccio Purpose: { Click folders to browse through any dir on your web server. Click text files to open, edit and save changes back to the server. In the text field, enter your FTP password in the format: ftp://user:pass@yourwebsite.com/(path) The path is optional. If you enter a specific file name and it doesn't exist, a new file will be created. If you enter a folder with a trailing slash, it's directory contents will be displayed. You can also upload/download images and other files and change permissions. Taken from the tutorial at http://musiclessonz.com/rebol.html } ] view center-face layout [ p: field 600 "ftp://user:pass@website.com/" [ either (to-string last p/text) = "/" [ f/data: sort append read to-url p/text "../" show f ][ editor to-url p/text ] ] f: text-list 600x400[ either (to-string value) = "../" [ for i ((length? p/text) - 1) 1 -1 [ if (to-string (pick p/text i)) = "/" [ new-p: to-string p/text clear at new-p (i + 1) p/text: new-p show p f/data: sort append read to-url p/text "../" show f break ] ] ][ either (to-string last value) = "/" [ p/text: rejoin [p/text value] show p f/data: sort append read to-url p/text "../" show f ][ editor to-url rejoin [p/text value] ] ] ] across btn "Download" [ file: request-text/title/default "File:" (join p/text f/picked) l-file: next to-string (find/last (to-string file) "/") save-as: request-text/title/default "Save as..." to-string l-file write/binary (to-file save-as) (read/binary to-url file) alert "Download Complete" ] btn "Upload" [ file: to-file request-file r-file: request-text/title/default "Save as..." join p/text (to-string to-relative-file file) write/binary (to-url r-file) (read/binary file) f/data: append read to-url p/text "../" show f alert "Upload Complete" ] btn "New Dir" [ make-dir x: to-url request-text/title/default "New folder:" p/text alert "Folder created" p/text: x show p f/data: append read to-url p/text "../" show f ] chmod: field 142 "read write execute" btn "Chmod" [ p-file: request-text/default rejoin [p/text f/picked] write/binary/allow (to-url p-file) (read/binary to-url p-file) (to-block chmod/text) alert "Permissions changed" ] do [focus p] ] |