scp - skip a file while running
No you can't. But you can stop scp
and use rsync
instead. It will copy only the differences left from the partial copy and you can exclude any files or dirs you don't want to transfer.
rsync -avP -e ssh --exclude=somefile --exclude=somedir ./localdir/ user@server:remotedir/
No, not with -r
or any other syntax that performs multiple file transfers within one scp
command.
That said, scp
also follows the UNIX paradigm: write programs that provide simple, precise functionality that can be chained together in interesting ways. This means it would be possible to write a loop that interactively performs individual invocations of the command, one per file. You would then be able to break out of the individual commands as they're being run. (Ctrl-C)
The code for this is being left as an exercise to the reader, but the need for this loop to execute within an interactive shell must be emphasized. Breaking out of a non-interactive shell would terminate the entire job.