James Thigpen
James Thigpen

Reputation: 869

Excluding .svn directories in Rake cp_r

I'm writing a rakefile using Albacore for my .NET stuff, and I'm trying to figure out the easiest way to copy a project to another directory (artifacts) while excluding the .svn directories in its subdirectories.

Suggestions? I'm running into a wall here.

Upvotes: 2

Views: 1552

Answers (3)

Filburt
Filburt

Reputation: 18061

Wouldn't be svn export to the other directory an option?

Upvotes: 2

Derick Bailey
Derick Bailey

Reputation: 72868

I know i'm late the game, here... but it's pretty simple with ruby:

FileUtils.cp(FileList["**/*"].exclude(".svn"), "some/destination/folder")

the FileUtils class mimics a bash shell's file utilities, so "mv" is "move" and "cp" is "copy".

The FileList object is built into Rake and is an easy way to create an array of files based on globs and other search parameters. the .exclude method of the FileList will exclude the files that match the pattern stated.

Upvotes: 6

Byron Whitlock
Byron Whitlock

Reputation: 53861

Use XCOPY /EXCLUDE. For example

XCOPY <src> <dest> /EXCLUDE:svn.txt

svn.txt contains \.svn

Upvotes: 2

Related Questions