Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you specify filenames using wildcards or regexes in the subversion mv command?

Tags:

svn

I want to do this so that I can say something like, svn mv *.php php-folder/, but it does not seem to be working. Is it even possible? No mention of it is made on the relevant page in the svn book.

Example output of svn mv *.php php-folder/ :
svn: Client error in parsing arguments

Being able to move a whole file system would be a plus, so if any answers given could try to include that ability, that'd be cool.

Thanks in advance!

like image 270
Tim Visher Avatar asked Sep 17 '08 20:09

Tim Visher


People also ask

Can MV interpret wildcards?

Can be used by: Standard wildcards are used by nearly any command (including mv, cp, rm and many others). this can represent any single character. If you specified something at the command line like "hd?" GNU/Linux would look for hda, hdb, hdc and every other letter/number between a-z, 0-9.

How do you use wildcards in Linux?

The wildcard '*' means it will match any number of characters or a set of characters. For example, S**n will match anything between S and n. The number of characters between them do not count. Example: Here, we can see in the result that files starting with 'A' and ending with 'f' are displayed.


1 Answers

svn move only moves one file at a time. Your best bet is a shell loop. In Bash, try

for f in *.php ; do svn mv $f php-folder/; done

On Windows, that's

for %f in (*.php) do svn mv %f php-folder/

Edit: Starting with Subversion 1.5, svn mv accepts multiple source files, so your original command would work. The shell loop is only needed for svn 1.4.x and earlier. (Of course, the shell loop will still work with 1.5; it just isn't necessary.)

like image 74
cjm Avatar answered Sep 19 '22 23:09

cjm