Symlink Removal Problem

Discussion in 'Software' started by dkocian, Jan 22, 2023.

  1. dkocian

    dkocian Private E-2

    Running Windows 10. Per suggestions from other sources, I ran the following from the command prompt as administrator.
    dir /AL /S C:\ | find "SYMLINK"
    This gave a long, long list of SYMLINKs but searching through it I found one pointing to the D: drive, so I ran it again like this:
    dir /AL /S C:\ | find "SYMLINKD"
    This gave me this result:
    12/07/2019 03:30 AM All Users [C:\ProgramData]

    I gather from this that the system has a Symbolic link in place to move all new additions to the ProgramData directory over to the D: drive.
    However, there is no ProgramData directory on the D: drive. It was there in the past, with two subdirectories, but it is gone.
    How do I remove the redirect?

    The ProgramData directory on the C: drive is substantial, with 3,326 folders and over 20 gigs of data. I cannot take a chance of losing it but am concerned that future data for all programs will just disappear since it is redirected to a non-existent directory.
    Further, I intend to remove the D: drive. It is a partition on the SSD and I want to add that space back into the C: drive to avoid getting out of space errors.
    Many threads about using rmdir under CMD or just deleting the directory in File Explorer, but the D: directory no longer exists, and I sure don't want to delete the directory on the C: drive, so I don't know where to go from here.
     
  2. Earthling

    Earthling Interplanetary Geek

    Symbolic links don't move anything around, they are just shortcuts to other folders. However if you are still concerned I suggest you run a malware scan.
     
  3. dkocian

    dkocian Private E-2

    No malware. This symbolic link was put in place back in 2019 to try and save space on a small SSD by redirecting stuff to another drive. I just can't figure out how to remove the redirect.
    PowerShell, for example, does not even recognize SYMLINK. The help files say the word does not exist. I can only find the redirect by using the command prompt. It was put in using MKLINK but that function does not give you any method of removing the link once you put it in.
     
  4. Earthling

    Earthling Interplanetary Geek

    You misunderstand. I use symlinks that way too, as they enable you to fool the computer into believing the files are someplace other than where they really are. In use you simply put the files wherever you prefer and create a symlink to them in the place the computer expects them to be. So nothing is moved about at all and they are harmless. I'll have a look later to se how to find and remove them - bit tied up atm.
     
  5. Earthling

    Earthling Interplanetary Geek

    Try right clicking C:\ProgramData - it may have something like unlink or similar you can take. However from what you say the link target on D: no longer exists so even if the symlink is still in place it isn't doing anything other than wasting a few cpu cycles.

    I used to do this with my OneDrive folder to enable me to keep the stuff I wanted in OneDrive actually on my D: drive but removed OneDrive years ago so can't study actual instances of symlinks now.
     
  6. dkocian

    dkocian Private E-2

    Thanks for the replies. I confess that every time I think I know how a SYMLINK works, I get proved wrong. From my first post, the computer just reported that C:\ProgramData had a SYMLINK to the D: drive. I think, or at least thought, that meant anytime a program wanted to write to the C:\ProgramData directory, that instead it wrote to the D:\ProgramData directory. If C:\ProgramData did not exist, but was only a SYMLINK, then I could just delete C:\ProgramData and I think the redirect would go away. I can't do that because that C:\ProgramData directory is huge. It is not just an alias for a directory on the D: drive. If it doesn't hurt anything, I can just leave it alone, but I don't like that cluttering up the computer. Next time I have a problem, I won't be able to confirm that that link didn't cause it.
    Also, I am concerned that if a program needs to write to C:\ProgramData, and it tried to write to D:\ProgramData because of the redirect, that it could hang up the system. I don't know and I can't really experiment with it because I can't afford to lose the data on the C: drive. I have backups, but when it comes to program files, those are sometimes not enough. Restoring a backup could mean that other programs won't have necessary updates.
    I am hoping that the system will recognize that the D: drive directory does not exist, and it will determine the link is invalid and will remove the link on its own. I read somewhere that this would happen but can't find that thread anymore. Fingers crossed. I'll report back here if it does happen.
    There is a similar thread to mine on the Microsoft website. Someone complained because the issue was raised two years ago and neither Microsoft nor anyone else had ever supplied a valid answer.
    Thanks!
     
  7. Earthling

    Earthling Interplanetary Geek

    You can relax - there isn't any way a symlink that can't find its target folder is going to mess up your system. If you can't see any unlink or similar option when you right click the c:\ProgramFiles folder then it's likely that the symlink has been removed by the system. More importantly, your system is actively using c:\ProgramFiles and would quickly become unusable if it was deleted. It would be simple to move it back to D: and re-create the symlink, which would declutter the system a bit, but given your lack of experience in this area I would not recommend it.

    The fact that symlinks have previously been created suggests that someone other than you has previously made significant changes to the system. If you know that person you may be able to get more clarification.
     
  8. Earthling

    Earthling Interplanetary Geek

    EDIT - ProgramData, not ProgramFiles - sorry:oops:
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds