Search code examples
filesvnunixcutack

copy SVN modified files including directory to a another directory


I have a list of files in my current working copy that have been modified locally. There are about 50 files that have been changed.

I am using the following command to copy files that have been modified in subversion to a folder called /backup. Is there a way to do this but maintain the directories they are in? So it would do something similar to exporting a SVN diff of files. For example if I changed a file called /usr/lib/SPL/RFC.php then it would copy the usr/lib/SPL directory to backup also.

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

Solution

  • It looks strange, but it is really easy to copy files with tar. E.g.

    tar -cf - $( svn st | ack '^M' | cut -b 8- ) |
    tar -C /backup -xf -