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?
backup
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 ...
svn status | grep '^[ADMR]' | cut -b 8- | xargs -I '{}' rsync -R {} /directry/
(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
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)
:
svn status | grep ^M | awk '{print $2}' | xargs -I '{}' cp --parents {} /backup/