I'm trying to get svn to ignore got large datafiles in a directory. Since all the files in the directory share the same extention, specifying a pattern in svn:ignore doesn't do. Is there a way to say "ignore files larger than N MiB"?
-
2Why would you want to only exclude large files of a type and not other ones? Doesn't that counter the idea of having a complete, consistent and revisioned copy of your project? Normally I exclude only files that are generated or external from the SVN tree. – Johannes Wachter Aug 19 '10 at 12:05
-
Yes it does, but my repository is limited in size, so I need to commit sparingly. Besides, these are datafiles and they never really change. – mbatchkarov Aug 19 '10 at 22:07
3 Answers
Put a list of the files you want to ignore (possibly using an OS tool such as find on Linux) and then do something like this:
svn propset svn:ignore "*" --targets filelist.txt

- 4,788
- 26
- 35
-
Not really what the OP is asking for: `"ignore files larger than N MiB"?`, perhaps the specific files can change and they're after a more general solution to ignoring large files? =) – Rob Aug 19 '10 at 12:01
-
2The svn propset command does not have a built in ability to filter based on file size. Without information about what other tools the OP has available I believe this is the most general solution other than manually issuing a series of svn propset commands. The filelist.txt file can be editted/regenerated as needed. – ChrisH Aug 19 '10 at 13:43
Essentially I would write a commandline script that iterates over all files of the desired filetype and than executes the svn propset
command mentioned by @ChrisH if the filesize is bigger than the boundary you define.
If your on Windows this stackoverflow question might be helpful.

- 1
- 1

- 2,715
- 17
- 17
Put a list of the files you want to ignore (possibly using an OS tool such as find on Linux) and then do something like this:
svn propset svn:ignore "*" --targets filelist.txt
If you take @ChrisH's answer and combine it with a pre-commit hook, that should solve the problem.
Using the amazing guide here, write a pre-commit hook that filters each file using the command referenced by @Johannes Wachter.

- 3,283
- 4
- 24
- 23