Over a million developers have joined DZone.

Copy All Svn:* Properties From One File To Another

The following script can be used to copy all SVN properties from one file (presumably a file that's already under SVN control) to another file (which you presumably want to put under SVN control, and which you want to check in with the same SVN properties).


ORIG=$1 ; shift ;
[ -e "$ORIG" ] || exit ;

for PROP in `svn pl "$ORIG" | sed -n '2,$p'` ; do
        VALUE=`svn pg $PROP "$ORIG"` ;
        for FILE ; do
                [ -e "$FILE" ] && svn ps $PROP "$VALUE" "$FILE" ;

# That's it, Folks!

If you put the above code in a shell script called...


... then you can run it as follows if you want to copy all svn:* properties FROM original.file TO blegga:

pvdb@localhost ~ $ ./svnprops.sh original.file blegga 
property 'svn:mime-type' set on 'blegga'
property 'svn:eol-style' set on 'blegga'
pvdb@localhost ~ $ _

... or as follows for multiple target files:

pvdb@localhost ~ $ ./svnprops.sh another.original.file blegga foo bar 
property 'svn:mime-type' set on 'blegga'
property 'svn:mime-type' set on 'foo'
property 'svn:mime-type' set on 'bar'
pvdb@localhost ~ $ _ 


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}