Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to copy files from a folder on a server using a batch file. However I don't want the files in the destination folder to be overridden. This is what i have:

set /p address=ip address:
pause
pscp -pw "password" "username"@%address%:/folder path/* c:\folderpath

This works however when it runs it overrides the files in the destination folder. Is there a way to make it skip over the files that are already in the destination folder?

share|improve this question
    
See also: superuser.com/questions/131801/…, aplawrence.com/Basics/no_clobber_scp.html, linuxquestions.org/questions/linux-software-2/… - the general suggestion seems to be 'use rsync instead'. Another suggestion is to use scp to transfer to a temporary directory and use a server-side script to copy things without overwriting. I imagine it would also be possible to use ssh to check for the existence of files in a client-side script, but that sounds a little tedious. –  Bob Apr 13 '13 at 7:31
    
See also: stackoverflow.com/questions/13410990/… - yea, another rsync suggestion. –  Bob Apr 13 '13 at 7:36

1 Answer 1

The SCP protocol isn't very sophisticated. The sending side can only blindly send the files and directories to the receiver. There's no standard option to avoid overwriting files on the destination.

You should look at more sophisticated transfer protocols, like SFTP or rsync as in the comments.

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.