Supersonic
Supersonic

Reputation: 430

svn checkout a single file but with full folder structure

Currently I am checking out a single file from a SVN repository like this:

SVN complete URL :

"https://svn_test_url/trunk/Documents/filename.txt"

Using the below command :

svn co --depth=empty "https://svn_test_url/trunk/Documents/" "local_folder_name" & cd "local_folder_name" & svn up "filename.txt"

And finally I get:

-local_folder_name
 -.svn
 -filename.txt

Question : I would like to checkout the complete folder structure till file.

So according to my example I expect the folder structure be like:

-local_folder_name
 -.svn
 -trunk
  -Documents
   -filename.txt 

Any help will be really helpful and appreciated. Thank you in advance

Upvotes: 0

Views: 1897

Answers (1)

Patrick Quirk
Patrick Quirk

Reputation: 23757

Since you already have to know the folder path to check out the file, just call mkdir first:

mkdir "local_folder_name\trunk\Documents" &
svn co --depth=empty "https://svn_test_url/trunk/Documents/" "local_folder_name" & 
cd "local_folder_name" & 
svn up "filename.txt"

Or if you really want SVN to handle it, use the --parents switch on svn up and change your checkout root:

svn co --depth=empty "https://svn_test_url" "local_folder_name" & 
cd "local_folder_name" & 
svn up --parents "trunk/Documents/filename.txt"

Upvotes: 1

Related Questions