ftp-backupThere are many great FTP Client Freewares like Filezilla but uploading the same folders again and again is a pain in a hass. So this little Script is a real time-saver as it will allow you to automate your backup or upload to FTP Server. I didn’t have to invent it as it’s the same copy-dir script that exists on Rebol Cookbook with a verbose refinement: I just tested that it really works with FTP :). So here it is:


ftp-backup: func [local-folder ftp-folder /verbose /local i] [

    i: 0
    if not exists? ftp-folder [
      make-dir/deep ftp-folder
        either verbose [
          print form [ftp-folder "folder created ..."]
        ][
          print i
        ]
    ]
    foreach file read local-folder [
        i: i + 1
        either find file "/" [
            ftp-backup local-folder/:file ftp-folder/:file
        ][
            either verbose [
              print file
            ][
              print i
            ]
            write/binary ftp-folder/:file read/binary local-folder/:file
        ]
    ]
]

To use it for example on Dreamhost FTP Server for example, type:


ftp-copy %"/c/install/wordpress/" ftp://ftpuser:ftppassword@maindomain.com/reboltutorial.com/

Note: to have ftp-backup available at startup, store it in user.r.

Bookmark and Share

Recent Articles