Copy SVN modified files only to another directory

I have a list of files in the current working copy that have been modified locally. Changed about 50 files.

I can get a list of these files by doing the following:

svn st | ack '^M'

Is there a way to copy these files and only these files to another directory called backup?

+3
source share
5 answers

Assuming ack is like grep ... you can do something like:

cp `svn st | ack '^ M' | cut -b 8-`` backup

I would post this as a comment ... but I don't know how to avoid backlinks in the comments ...

+4
source
svn status | grep '^[ADMR]' | cut -b 8- | xargs -I '{}' rsync -R  {} /directry/
+2
source

(bash):

#!/bin/bash
set -eu

# for each modified file
for f in $(svn st| awk '/^M/{print $2}'); do
    # create a directory under backup root and copy the file there
    mkdir -p .../backup/${f%/*} && cp -a $f .../backup/$f
done
+1

Windows 8 svn:

(FOR /F "tokens=2 delims== " %i IN ('svn st ^| findstr "^[ADMR]"') DO @echo %i & echo f| xcopy /f /y %i c:\projects\backup\%i)
+1

:

svn status | grep ^M | awk '{print $2}' | xargs -I '{}' cp --parents {} /backup/
0

All Articles