Tec(h)tonic

Insights into building a solid I.T. foundation in the mid-size business world.

Single line command to copy file from one file server to another

terminalHere’s a simple command to copy a specified file from one file server to another – I use this to send our office contact list (stored on our local Samba file server) to our branch office’s file server whenever I update it so that both offices always have access to the current copy.

Note that this requires FTP access to the remote server.

curl -u remoteSvrUsername:password -T /fullPathToFile/fileName ftp://remoteSvrName/pathToFileLocation/

And, yes: I realize this is a goofy way to maintain a contact list, but people like having an Excel spreadsheet – what can you do? Actually, what you can do is to create an Active Directory-aware, dynamically-updating company directory website – something I’ve done and will detail in a future post!


2 responses to “Single line command to copy file from one file server to another”

  1. Stefan Avatar
    Stefan

    You can simplify this further by using pre-shared SSH keys, and then you can just use scp or rsync to transfer the file without having to run an FTP server on the remote:

    `scp /fullPathToFile/fileName remoteSvrName:/fullPathToFile/fileName`

    …admittedly, you may have other reasons for needing full FTP server functionality on the remote, but if you just need to host resources that employees are downloading, I would argue that you’re better off putting those on the intranet site.

    1. Christopher Scott Avatar
      Christopher Scott

      Yeah, funny you mention that, Stefan – I’m actually working on a script right now where setting up preshared SSH keys is advantageous because it’s a script I want to run on a schedule and thus can’t have it prompting me for passwords)!

Leave a Reply

Your email address will not be published. Required fields are marked *