Search code examples
filesvndirectoryadditionversioning

Oneliner for SVN adding files inside unversioned subfolders


I have files that i want to add to svn that are inside a number of nested sub folders. All the subfolder tree is still unversioned. Say i want to version file1 and file2 (but not file 3) inside subsubfolder and no other file inside subfolder (i.e. file0). The current filesystem is as follows

trunk
|--subfolder
   |--file0
   |--subsubfolder
      |--file1
      |--file2
      |--file3

Trunk is versioned, subfolder and subsubfolder are not versioned.

    svn add /subfolder/subsubfolder/file1 

gives

    svn: warning: W155010: The node 'trunk/subfolder/subsubfolder' was not found.

    svn: E200009: Could not add all targets because some targets don't exist

    svn: E200009: Illegal target for the requested operation

I wonder if there is a quick, potentially one-liner, command to add those files instead of going through adding all the subfolders along the way (without adding their content) and then finally adding the files.


Solution

  • Use the --parents option. Here is an example:

    svn add --parents /subfolder/subsubfolder/file1