Question Symbolic links, shell folders and keeping path access clean (windows 10)

rchamlen

Distinguished
Sep 15, 2014
23
1
18,515
0
Background: I have an older desktop with a system drive (an m.2 ssd) topping out on capacity. Because of the age of the machine (which will likely need to be replaced sometime relatively soon) I opted to just add an additional spinning hard drive to carry the load of the heavily used storage locations ("Pictures" and a "Onedrive" directory) instead of cloning the whole system onto a bigger m.2 drive.

New drive is successfully installed and the Pictures folder (and its content) successfully moved onto the new hard drive.

Here is the problem: I have several programs (image scanners and a backup program used to real-time image (for backup) data off onto a NAS/RAID (program is Allway Sync). These programs for the most part use a full path to the Pictures (and other) folders .... and so while I can go directly to the Pictures folder in the file explorer using either the quick access or Libraries on the left side of file explorer, now the direct path "C:\users\username\Pictures" is no longer valid.

So ..... I think to myself: "self .... just put a symbolic link in the user directory and all shall be fine". Well, all is not fine. after putting a symbolic link (actually a "junction" in that location (syntax used: mklink /j c:users\username\Pictures d:\my_large_directories\Pictures) (yes, command run from command prompt run as admin) the command runs without errors, and the new link "Pictures" appears in my home directory ..... BUT when trying to cd into that link (either from command window or in file explorer) I get an error indicating that the link "does not exist" (which is weird, because I can delete it.....).

This approach DOES work if I specify a target directory that is NOT the Pictures directory (i.e. not a "special" or "shell" folder).

I suppose this is occurring for some reason because the target folder IS a special folder, but dont really understand why or how to circumvent this (from what I have been able to dig up, these Shell Folders for users are defined within the Registry (NOT via a shell environment variable, despite the name of the things....), and I have no real wish to play with the registry.

So .... a long winded way of basically asking is there a way to relocate my Pictures directory to another drive, yet still have a way for at least some of my running executables to access that directory via a path that looks like c:\users\username\Pictures ????? (or am I stuck with having to hard-wire the paths to that new directory into said executable programs)????

I am going to need to do this same thing with a Onedrive directory (also apparently a shell folder) which is also tied up with large amounts of data that are routinely mirrored for backup. Your thoughts are most appreciated!
 

USAFRet

Titan
Moderator
Mar 16, 2013
154,716
11,265
176,090
24,154
Simple solution:
Don't use the Libraries.

Windows and applications have gotten soooooo much better at managing multiple drives and drive letters.
Symlinks is a concept long past its prime.

In 2022, many/most applications will default to the last place you saved.

I have multiple drives, one for each general category of use.
Photo, video, CAD, etc.

My main photo tools of Lightroom and Paintshop Pro...they either default to the last drive+folder, or have a designated place they import and export with.

I don't think either of those have ever touched my Pictures Library.
 
So .... a long winded way of basically asking is there a way to relocate my Pictures directory to another drive, yet still have a way for at least some of my running executables to access that directory via a path that looks like c:\users\username\Pictures ????? (or am I stuck with having to hard-wire the paths to that new directory into said executable programs)????
Yes, but I'd advise against setting a new path for the User folders because when doing such, Windows will move everything over to the new path. While this sounds like a case of "well duh, I'm going to work there from now on," getting this wrong can lead to issues that can only be fixed, AFAIK, by moving to a new OS user account.

As mentioned, most programs are good about remembering the last place you looked in. But if you constantly switch around folders, I suggest messing around with the Libraries feature and setting that up, with the default save path on your new drive.
 

rchamlen

Distinguished
Sep 15, 2014
23
1
18,515
0
Simple solution:
Don't use the Libraries.

......

I don't think either of those have ever touched my Pictures Library.
You know, its funny ..... "way back when" I never used to use the libraries and did what you are doing. Mostly this was because of limited space on the drives available then. somewhere along the way the drives got big enough that I stopped that and just let Windows do its thing (while more or less conciously maintaining my own ignorance of just what was stored where and how things were referenced......

Your point is well taken ..... I might just go back to that approach. Thanks.
 

USAFRet

Titan
Moderator
Mar 16, 2013
154,716
11,265
176,090
24,154
You know, its funny ..... "way back when" I never used to use the libraries and did what you are doing. Mostly this was because of limited space on the drives available then. somewhere along the way the drives got big enough that I stopped that and just let Windows do its thing (while more or less conciously maintaining my own ignorance of just what was stored where and how things were referenced......

Your point is well taken ..... I might just go back to that approach. Thanks.
'way back when', relocating the Libraries was a thing to do. As you say, limited drive space.
Ssd were small, and you had to manage that space carefully.
I even wrote a couple of tutorials on it.

Today?
Not even.

Th H is my photo drive, the G for video, the F for CAD work, etc.

Symlinks and moving libs gets messy during an OS reinstall.
 

rchamlen

Distinguished
Sep 15, 2014
23
1
18,515
0
Yes, but I'd advise against setting a new path for the User folders because when doing such, Windows will move everything over to the new path. While this sounds like a case of "well duh, I'm going to work there from now on," getting this wrong can lead to issues that can only be fixed, AFAIK, by moving to a new OS user account.

As mentioned, most programs are good about remembering the last place you looked in. But if you constantly switch around folders, I suggest messing around with the Libraries feature and setting that up, with the default save path on your new drive.
Just to be clear, I was not talking about moving the entire User folder ..... only the location the Pictures special directory. I guess your suggestion of "truly embracing" the libraries would also work ..... Then for the other apps accessing the library I would need to reference the path c:\users\username\appdata\roaming\microsoft\windows\libraries\pictures.

Yuck .... such and ugly path ..... how on earth did they ever conceive of such a thing???? but you are right .... that is a pretty low stress approach to take....
 

rchamlen

Distinguished
Sep 15, 2014
23
1
18,515
0
What application are you use that demands a text based path and not just use the OS's file dialog?
Allway Sync, and several document and photo scanning apps. To be sure, each has a "browse" option .... but in the end the dialog is a full path designation ..... either I can type it all out manually, or the browse function will paste the full path into the path dialog...

In short, these apps do NOT have access to my login environment .... they are running as admin in the background
 

ASK THE COMMUNITY