简体   繁体   中英

How to revert files with specific extension in svn?

I would like to do something like this:

svn revert --recursive mydata/*/*.txt

and I want it to revert all files which have extension *.txt in the directory mydata. Is there a way to do that?

On a POSIX-compatible OS (Linux/Mac/Cygwin):

find mydata -mindepth 2 -name \*.txt | xargs svn revert

On Windows (use %%G in a batch file, %G on the command line):

FOR /R mydata %G IN (*.txt) DO svn revert "%G"

Strictly speaking, the Windows command will affect mydata/*.txt , mydata/*/*.txt , mydata/*/*/*.txt , and so on, so maybe it's not exactly what you're looking for... but maybe it's enough to get you there.

Are you using Linux or some other Unix variant which supports find ? (Heck, it would probably be fine in cygwin too.) If so, try this:

svn revert `find mydata -name '*.txt'`

If you've got a lot of files you may need to use xargs instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM