Easy Way to Create Symlinks?

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
User avatar
Gadget
Posts: 4
Joined: Tue May 24, 2022 8:14 pm

Easy Way to Create Symlinks?

Unread post by Gadget »

Hi everyone,

I‘d like to create some personal playlists within my console and Arcade specific game directories. As I don‘t want to copy the related games to those new playlist directories I‘d prefer to use shortcuts. I heard that MiSTer uses something called symlinks for that purpose.

What is the easiest way to set those? I‘ve already tried creating symlinks in a MacOS app called „Cyber Duck“ which I also use to transfer games to my MiSTer but those symlinks didn‘t work. I also have a windows pc at hand if that helps.

By the way, I‘m aware of the Arcade organizer script but I want to create some more specific directories and for console games alike.

I‘d appreciate some help very much. Thank you!
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: Easy Way to Create Symlinks?

Unread post by jca »

You can use Linux command prompt or you can use WinSCP in a way similar of creating shortcuts in windows file explorer. I tend to use WinSCP as I have it always open.
kerobaros
Posts: 5
Joined: Sun Jun 07, 2020 11:26 am

Re: Easy Way to Create Symlinks?

Unread post by kerobaros »

While it doesn't create symlinks, I've been using wizzomafizzo's Favorites script to do something similar, ie. making a folder full of shortcuts to my favorite games that are selectable on the main menu. Maybe it would work for you too!
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Easy Way to Create Symlinks?

Unread post by Malor »

The way I normally do that is by using the 'ln' command at the command line. Because most of the Mister system is on a FAT filesystem, you should only use symbolic links, and you can run into weird situations where some links just won't work, you'll get an error message. I have that problem when trying to link, for instance, from my SMB3 /media/fat/cifs filesystem back elsewhere in the hierarchy. I haven't puzzled out what the actual rules are.

To make a symlink, drop to the command line with F9 (or with an SSH connection, which is easier after you have SSH running), and type:

Code: Select all

ln -s /path/to/target /path/to/symlink
edit: symlinks can also be relative, like this:

Code: Select all

ln -s ../parentfile symlinkfile
or like this:

Code: Select all

ln -s subdir/subdirfile symlinkfile
The ../ goes up one directory. You can use several ../ if you need to go up several directories.
User avatar
Gadget
Posts: 4
Joined: Tue May 24, 2022 8:14 pm

Re: Easy Way to Create Symlinks?

Unread post by Gadget »

Thank you all for your kind suggestions! :D

I tried WinSCP and created some symlinks and they all work great :)

Using relative target paths (../) was important for my desired folder structure so the symlinks refer to the correct paths that contain the original game files.

Only downside is that you can create one symlink at a time only, right? Selecting multiple game files in WinSCP for creating symlinks would be much more convenient.
User avatar
wizzo
Scripting Wizard
Posts: 183
Joined: Sat Mar 12, 2022 11:32 am
Has thanked: 15 times
Been thanked: 240 times

Re: Easy Way to Create Symlinks?

Unread post by wizzo »

kerobaros wrote: Thu Aug 18, 2022 7:49 pm While it doesn't create symlinks
It does! It just a simple wrapper around doing this exact thing, making symlinks. Glad it's working well for you
Gadget wrote: Sun Aug 21, 2022 10:57 am Only downside is that you can create one symlink at a time only, right? Selecting multiple game files in WinSCP for creating symlinks would be much more convenient.
My script can't link files in bulk but it does remember the last path you were in between linking, so if you want to add a lot of stuff at once you can get into a pretty quick workflow tapping enter through the dialogs. It's a lot faster than doing it manually on the command line anyway. You can try it here: viewtopic.php?t=4470

If you don't like the _@Favorites folder it creates you can just rename it afterwards or move it somewhere else. It's making plain symlinks same as you're doing right now. If you need to symlink *a lot* of stuff then you need to write a bash script or one-liner to do it like this: https://www.diskinternals.com/linux-rea ... -one-line/
User avatar
Gadget
Posts: 4
Joined: Tue May 24, 2022 8:14 pm

Re: Easy Way to Create Symlinks?

Unread post by Gadget »

Thanks a lot for this clarification! I am looking forward to try out your Favourites script then :)
kerobaros
Posts: 5
Joined: Sun Jun 07, 2020 11:26 am

Re: Easy Way to Create Symlinks?

Unread post by kerobaros »

wizzo wrote: Sun Aug 21, 2022 5:38 pm
kerobaros wrote: Thu Aug 18, 2022 7:49 pm While it doesn't create symlinks
It does! It just a simple wrapper around doing this exact thing, making symlinks. Glad it's working well for you
whoops, brainfart on my part. What they said.
User avatar
Gadget
Posts: 4
Joined: Tue May 24, 2022 8:14 pm

Re: Easy Way to Create Symlinks?

Unread post by Gadget »

wizzo wrote: Sun Aug 21, 2022 5:38 pm
My script can't link files in bulk but it does remember the last path you were in between linking, so if you want to add a lot of stuff at once you can get into a pretty quick workflow tapping enter through the dialogs.

If you don't like the _@Favorites folder it creates you can just rename it afterwards or move it somewhere else.
Today I tried your Favourites script and it worked great for me regarding Arcade games! It really is a lot faster. I just went through all the games creating a bunch of symlinks and sorted them in my personal folders afterwards. I especially like that your script always returns to the last entry a symlink was created for. Very handy, thank you :-)

One question though. Regarding console games it seems that your script creates mgl-files only. As I‘d like to select games within the core menues I prefer symlinks here too. Is it possible like with arcade games?
User avatar
wizzo
Scripting Wizard
Posts: 183
Joined: Sat Mar 12, 2022 11:32 am
Has thanked: 15 times
Been thanked: 240 times

Re: Easy Way to Create Symlinks?

Unread post by wizzo »

Gadget wrote: Tue Aug 23, 2022 1:09 pm One question though. Regarding console games it seems that your script creates mgl-files only. As I‘d like to select games within the core menues I prefer symlinks here too. Is it possible like with arcade games?
It is not possible sorry. It's something I could consider adding support for but would need some investigation. In my experience with trying to symlink ISOs I found I wasn't able to launch them from the core's own launcher menu.
Post Reply