42

How can I use the svn export command to get a single file from the repository?

I've tried this:

svn export e:\repositories\process\test.txt c:\

But I get this error:

svn: e:\repositories\process is not a working copy

Amos M. Carpenter
  • 4,848
  • 4
  • 42
  • 72
Delta
  • 2,004
  • 3
  • 25
  • 33

5 Answers5

57

Guessing from your directory name, you are trying to access the repository on the local filesystem. You still need to use URL syntax to access it:

svn export file:///e:/repositories/process/test.txt c:\test.txt
jason.rickman
  • 13,931
  • 1
  • 22
  • 14
  • 1
    I think you don't even need to provide complete path using file:// scheme; Just move to the directory where you code resides and use svn export command there. For example you code is present in someting/someting/code, so mov to something/something us cd command and run the following command svn export ./code ./code_new this command will export all your code in code_new directory. Note that you don't even need to cread code_new directory yourself, export command will do it itself. correct me if I'm wrong at any place. – Ans Apr 21 '13 at 07:47
20

You don't have to do this locally either. You can do it through a remote repository, for example:

svn export http://<repo>/process/test.txt /path/to/code/
Liam
  • 27,717
  • 28
  • 128
  • 190
Robert Duchnik
  • 1,337
  • 11
  • 4
5

For the substition impaired here is a real example from GitHub.com to a local directory:

svn ls https://github.com/rdcarp/playing-cards/trunk/PumpkinSoup.PlayingCards.Interfaces
svn export https://github.com/rdcarp/playing-cards/trunk/PumpkinSoup.PlayingCards.Interfaces /temp/SvnExport/Washburn

See: Download a single folder or directory from a GitHub repo for more details.

Community
  • 1
  • 1
John Washburn
  • 568
  • 1
  • 5
  • 11
1

I know the OP was asking about doing the export from the command line, but just in case this is helpful to anyone else out there...

You could just let Eclipse (plus one of the plugins discussed here) do the work for you.

Obviously, downloading Eclipse just for doing a single export is overkill, but if you are already using it for development, you can also do an svn export simply from your IDE's context menu when browsing an SVN repository.

Advantages:

  • easier for those not so familiar with using SVN at the command-line level (but you can learn about what happens at the command-line level by looking at the SVN console with a range of commands)
  • you'd already have your SVN details set up and wouldn't have to worry about authenticating, etc.
  • you don't have to worry about mistyping the URL, or remembering the order of parameters
  • you can specify in a dialog which directory you'd like to export to
  • you can specify in a dialog whether you'd like to export from TRUNK/HEAD or use a specific revision
Community
  • 1
  • 1
Amos M. Carpenter
  • 4,848
  • 4
  • 42
  • 72
1

Use SVN repository URL to export file to Local path.

     svn export [-r rev] [--ignore-externals] URL Export_PATH
     svn export http://<path>/test.txt C:\Temp-Folder
Nitin Lawande
  • 563
  • 1
  • 4
  • 8