Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know it's possible to use secure file transfer protocol to transfer files from remote locations to the local box, but is it possible to use it to transfer files from some local directory to another local directory?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

If you execute

scp /tmp/a /tmp/b

scp does a real local copy, since both source and target are local paths.

If you try the same with a command line SFTP client, you'll notice that you have to connect to a server before being able to issue commands. Of course it is both possible that you connect to the local server and send a file over the connection without actually leaving the machine and that a given implementation also provides a possibility to effect local copy operations. The former is a bit wasteful, while the latter is definitely implementation dependent.

share|improve this answer
    
Rsync will do the same given two local paths. –  David Pashley Jun 8 '09 at 17:11

You can definitely do this with scp, but I haven't tried this with sftp before. You'll get the most accurate answer by trying it out yourself though.

share|improve this answer
    
I definitely would've - but the java class that does the transfering needs a fair bit of setting up, so I was wondering if anyone knew the answer off-hand. Thanks though =) –  echoblaze Jun 8 '09 at 16:38
    
Oh ok, I thought you were using client/server software rather than a library. –  Dana the Sane Jun 8 '09 at 16:40

There's nothing in the protocol to stop that happening no, although your actual code might object, depends on the code you're using I guess.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.