Exclude folder form Symbolic link ?


  1. Posts : 98
    Windows10
       #1

    Exclude folder form Symbolic link ?


    Can I use Xcopy / Robocopy to create not only a symbolic link but exclude a folder from the symbolic link creation ?
      My Computer


  2. Posts : 9,785
    Mac OS Catalina
       #2

    What is the reason why you are trying to create the Symbolic link? No need for some third party software to do this, since Windows can already do it on its own. The Complete Guide to Creating Symbolic Links (aka Symlinks) on Windows A little more information for you. What are Symbolic Links? How do you create Symlinks in Windows 10?
      My Computer


  3. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #3

    bro67 said:
    What is the reason why you are trying to create the Symbolic link? No need for some third party software to do this, since Windows can already do it on its own.
    Xcopy and Robocopy are not third party apps - they are Windows 10 command line utilities, presumably being used here to make backup copies of user files. I wrote my own .bat file using Robocopy that does full or incremental backups of my user folder to an external or network drive of my choice. I very soon learned the perils of Robocopy and symbolic links...
    The dangers of robocopy and symbolic links

    The switch I had to use for Robocopy is:
    /XJD :: eXclude Junction points for Directories.

    This one may be of use to @JerometheGiraff:
    /SL :: copy symbolic links versus the target.

    You could try combining that with...
    /XD dirs [dirs]... :: eXclude Directories matching given names/paths.
    ...but I'm not sure if that applies to symbolic links.

    Get to Know Robocopy for More Powerful File Management
    Robocopy and a Few Examples
    Type Robocopy /? in a command prompt for the full list of options or see:
    https://technet.microsoft.com/en-gb/...mands/robocopy

    Xcopy is far older than Robocopy and dates back to DOS 3.2. It supports the options:

    /EXCLUDE:file1[+file2][+file3]...
    Specifies a list of files containing strings. Each string should be in a separate line in the files. When any of the
    strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.
    ....
    /B Copies the Symbolic Link itself versus the target of the link.

    Type Xcopy /? for the full list.
    Last edited by Bree; 26 Mar 2017 at 02:15. Reason: add Xcopy
      My Computers


  4. Posts : 98
    Windows10
    Thread Starter
       #4

    What does the following mean with regards to Robocopy; Is it simply re-phrasing what symbolic links create in general ?
    /SL :: copy symbolic links versus the target.
      My Computer


  5. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #5

    I read...
    /SL :: copy symbolic links versus the target.
    ...as:

    /SL :: copy the symbolic links as symbolic links versus copying the target files/directories that the links point to

    ...but it's not something I've tried yet so can't be sure.
      My Computers


  6. Posts : 98
    Windows10
    Thread Starter
       #6

    "C:\<directoryName> /sl /xd dirs <SubdirectorytoExclude>" "<SymbolicLinkDirectoryLocationToCreate>"
    The above minus the folder\directory names is the command I tried to create a symbolic link but exclude a sub-directory\folder from the source directory\folder. Instead I got an Error3 (0x00000003) from Robocopy ?
      My Computer


  7. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #7

    Error 3 is 'system cannot find path specified'. You appear to have put your destination at the end of the command (as you would for Xcopy).
    The Robocopy syntax takes some getting used to. If you’re familiar with the standard Copy and Xcopy commands, you’ll have to unlearn their syntax and get used to Robocopy’s unconventional ways.
    Get to Know Robocopy for More Powerful File Management

    That is not the correct order for Robocopy - it's 'source' 'destination' 'files' 'switches'.

    Usage :: ROBOCOPY source destination [file [file]...] [options]
    source :: Source Directory (drive:\path or \\server\share\path).
    destination :: Destination Dir (drive:\path or \\server\share\path).
    file :: File(s) to copy (names/wildcards: default is "*.*").
    You may also find it useful to set retries to zero with /r:0 (in case of locked files) otherwise the default is 1 million retries (with a 30 second wait between each) :)
      My Computers


  8. Posts : 98
    Windows10
    Thread Starter
       #8

    Using this command Robocopy did work, although not in the way I wanted it to work.

    "C:\<sourceFolderPath>" "C:\<folderA>" /sl /xd

    Two things;
    a) Symbolic link wasn't created which linked the source to the new target
    b) Sub-folder I specified wasn't excluded from being included in the Symbolic link creation :)
      My Computer


  9. Posts : 31,611
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #9

    I'm afraid we're fast approaching (exceeded?) the limits of my knowledge/experience. Hopefully someone else may be along to help.
      My Computers


  10. Posts : 98
    Windows10
    Thread Starter
       #10

    I hope :)
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:50.
Find Us




Windows 10 Forums