I'm try开发者_StackOverflowing to automate some stuff in SVN, and part of that is copying a .svn file (the one that contains where a directory should update their files from) to a local drive.
I'm using the following code:
File.Copy(@"X:\SVN\.svn", @"C:\SVN\.svn, true");
And I get the following error:
Access to the path 'X:\SVN\.svn' is denied
Am I just not allowed to move these types of files around? I know by default they are hidden, so maybe that's what's going on. Or is there a way in C#, I can just create a new .svn file so I don't have to bother with permissions and the like?
Thanks!
Last time I checked, .svn
was a directory. You probably can't copy a directory with File.Copy, or the directory is in use (sharing lock).
Have a look at ProcessExplorer's find function (in Sysinternal Suite) to find out which process uses it (perhaps TortoiseSVN?)
Perhaps schedule your replication using Rich Copy which is a RoboCopy clone from Microsoft that will copy permissions, incremental update etc.
Typically this is because you have tortoise running, and the tortoise cache has the file locked. If you shut it down in task manager you can do whatever you'd like with hit.
That said, what is the purpose of copying it? Are you cloning the project?
If you are on Windows and using TortoiseSVN, then the .svn is actually a directory so you can't use File.Copy on it.
精彩评论