Is there a way to perform a SVN checkout (or export), which would fetch only the directory structure; that is to say, no files?
You can specify --non-recursive to the checkout command, might help you to get what you want.
A use for checking out just the directory structure is a partial workaround for not being able to exclude one or more directories from being checked out. It is assumed that the cost of just checking out the directory tree is negligible in comparison to checking out the full source. With a versioned directory structure checked out I could then use Subversion's update and sparse directories to selectively pick what directory trees should have files.
on windows and with TortoiseSVN you can do Checkout -> checkout depth: only this item. this way you can get single folders/files. you could rebuild your structure this way (using the repobrowser). a bit cumbersome, but doable if your directory structure is not too complicated. i preferred this over checking out thousands of small files (several gigabytes) over slow network ...
svn ls -R {svnrepo} | grep "/$" | xargs -n 1 mkdir -p
Export, not a checkout.
[Updated]
With checkout:
env REPO={repo} sh -c 'svn ls -R $REPO | grep "/\$" | xargs -n 1 svn co --depth=empty $REPO'
This will be pretty slow for anything too large.
There is a python script in the contrib tools of subversion, which creates the directory structure with empty files. With a little bit of python knowledge, it should not be to hard to skip creating the files at all.
Just wanted to add, if you need to do this server-side (i.e. not checking out the repository first), the equivalent to svn ls
is svnlook tree --full-paths
.
I had to create a copy of a 50GB repo's folder structure and used the hints I found here to do it without having to create a working copy of the whole thing.
My code was:
svnlook tree /path/to/repo --full-paths | grep "/$" | grep -v "^/$" | xargs -I {} mkdir -p "{}"
The grep -v "^/$"
because the output contained a single / (i.e. file system root folder) and I didn't want to mess around with that.