A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label ftp. Show all posts
Showing posts with label ftp. Show all posts

How to sync over FTP

Don't re-invent the wheel.

1) Install rsync instead, which is designed with syncing in mind.

2) ftpsync was written a decade ago. Perhaps it has been updated since.

3) lftp syncs over FTP and is being actively maintained.

4) Perl package turbo-ftp-sync may also fit the bill.

Move directory on FTP server

without downloading and re-uploading:

rnfr source_dir
rnto target_dir

Good FTP clients

  • WinSCP (Windows)
  • WS FTP LE (Windows)
  • FileZilla (Windows, Linux)
  • FireFTP (Windows, Linux)

Developing over FTP

Using Eclipse and RSE plugin:
  • Logs in okay
  • But seems to always be closing directory sub-trees I've opened in 'Remote Systems' panel
  • It wants to do an 'ls' on every parent directory in the hierarchy, every time I change files. Very slow.
Using CurlFtpFS:
  • Install in Ubuntu from the software centre
    • to mount: curlftpfs -v username:password@server.example.com local_dir/
    • to unmount: fusermount -u local_dir/
  • Performance is unusably slow... Eclipse wants to know about every single file on the remote server, not just the ones I'm editing.
  • Saving the file through Eclipse using CurlFtpFS takes even longer than it would to upload it separately.
Using FileZilla and gedit:
  • Browsing is fast
  • Editing is fast
  • But you have to navigate to every file manually each session, it doesn't remember what you had open
  • The system of holding temp files locally is not ideal, but FileZilla detects changes in them very nicely
  • You still can't grep over the files as they're all held remotely, and it's a bit fiddly to navigate to a specific file
    Editing locally with Eclipse, and uploading after changes are made:
    • Write an Ant script to upload any modified files?
    • ...to investigate

    Automate an FTP script

    in the ftp script put.pl:
    #!/bin/bash
    HOST="example.com"
    HOMEDIR="/"
    ftp -i $HOST <<-EOF
    passive
    cd $HOMEDIR
    put $1
    quit
    EOF
    echo "I put the file "$1

    in ~/.netrc:

    machine example.com
        login [username]
        password [password]

    to run:
    put.pl [filename]

    FTP client for Linux and Mac

    Filezilla is brilliant, and extremely fast.

    Edit text files on remote linux servers

    UNTESTED:

    > I've never managed to figure out how to rig up editors to edit
    > files on remote servers.

    On the server, put this in smb.conf

    [homes]
    comment = Home Directories
    hide dot files = yes
    read only = No
    browseable = yes


    Then in the finder/windows explorer connect to 'smb://hostname/' . Then make an alias to it on your desktop.

    Alternatively, TextWrangler on the Mac has an ftp/sftp browser.

    http://www.barebones.com/products/TextWrangler/

    Beware of backslashes in login strings

    using URI to parse an ftp connection string like:
    ftp://domain\user:pass@host/path
    ...can lead to problems.
    The backslash is not a legal URI character, so $uri->user may bring back just the domain!