Sign in to follow this  
EliotAugusto

Symlinks in C#

Recommended Posts

EliotAugusto    100
This is going to be a bit lengthy, I always tend to give too much information. But what I want is very specific, however what I want may be wrong. Skip down to the "[b]Questions" [/b]portion if you don't care about the why.


[b]Purpose:[/b]
Create a program that will handle current criteria with minimal impact to existing network structure, which poor at best. Learn more about programming and thinking abstractly when being forced to use systems already in place rather than inventing a new one. Also to document the process in case anyone having a situation similar to mine will be able to easily identify the steps and solve their issue quicker.

[b]Problem:[/b]The issue I am currently attempting to solve is that I have multiple files, on multiple HDDs, on multiple computers(rudimentary home network), all of which I want to access through one Virtual drive. I want to access it through virtual drive so that I can just share that one drive and have all computers access just those files. To narrow it down even further, the intended purpose is to share that virtual drive with a PS3 Media server and the computer that hooks up to the TV for movie viewing.

I have found out that the PS3 recognizes Directory Junctions made with the cmd prompt, I am relatively certain it will recognize hard links with the command 'mklink' as well. CMD is a bit limited in what I'd like to create that will handle this whole process for me. Rather than just download a program that will do this, I want to learn more about programming by doing this task.

[b]Intended Solution:[/b]
Create a program in C# or C++(both of which I have rudimentary knowledge of) that will scan selected directories and/or drives for files of type " \\...\*.avi/mp4/mp3/mkv etc..." make a symlink in a target directory of my choosing, in a sub-directory based on criteria(genre/year/alphabetically) that is provided manually or automatically through a script I may write later to learn Python, that can either grab a name automatically or allow me to edit the name.

Add a .bat file to startup that will [code]subst x: D:\Junction[/code] and all of the symlinks will be created in a directory structure similar to:
[code]
D:\Junction\All\...
D:\Junction\Action\...
D:\Junction\Anime\...
etc...[/code]


I intend to have an actual GUI, and when I select run it will scan the selected directories, compared the results from the scan and compare with an index file to determine if the movie has already had a link created with it. I don't intend to have the original file renamed at any point negating a large portion of the negative aspects of using an index file that holds all the files that have already had a symlink created on their behalf.

Unless there is a better solution I intend to have copies of the Symlink in each folder that the movie falls under. E.G. - Unstoppable would have a Symlink's created in:
[code]
\\...\All
\\...\Suspense
\\...\Drama
[/code]
With this I hope to have it as close to a service like Netflix making it an easy to use file structure that can be used on a multitude of platforms(360/PS3/PC/Phone) that connect to my home network wirelessly.


[b]Questions:[/b]
[s]-Is there a way I can search by a type of all video/audio formats rather than making a list of all formats and searching that way?[/s]
[s]-Is using C#(preferred language) possible to create a system like this?[/s]
[s]-Would I be better off just learning and making a Python script to accomplish the goals?[/s]
[s]-Is there a better solution than using Symlinks to have a directory storing all files I want pointed there, without that directory taking up the space on the HDD with the junctions?[/s]
-I have looked, but found very limited information on this topic. In regards to Symlinks, is there a good source that you know of that I may look at, read and solve the problem with lots of critical thought?
-Any advice you have, I will gladly take.
-More questions to come as my progress moves forward

[b]Progress:[/b]
-[i]Create GUI that has functionality - Current Task[/i]
-Create Symlinks Automatically based off of criteria input in the GUI
-Scan directories and create Symlinks based off of criteria input in the GYI
-Create directories and sub-directories containing Symlinks
-Bug Fixes

*Note*
Will post source code as I go, if you feel like critiquing it I will probably love you forever.

Share this post


Link to post
Share on other sites
Telastyn    3777
[quote name='Screeling' timestamp='1313012118' post='4847344']
-Is there a way I can search by a type of all video/audio formats rather than making a list of all formats and searching that way?
[/quote]

It depends on the scope of your problem. If the target directories are easily enumerated that might be easier. Listing each of the formats isn't going to take very long compared to the problem at hand.

[quote]
-Is using C#(preferred language) possible to create a system like this?
[/quote]

Sure.

[quote]
-Would I be better off just learning and making a Python script to accomplish the goals?
[/quote]

Maybe.

[quote]
-Is there a better solution than using Symlinks to have a directory storing all files I want pointed there, without that directory taking up the space on the HDD with the junctions?
[/quote]

Personally, it seems as though getting a dedicated file server with some cheapy raid 5 setup, move all your files into there using the file explorer (or some automated utility) and then letting the computers pull from that is a far better solution than trying to keep symlinks up to date with a variety of other machines. I wouldn't be surprised if you could just map the drives of the various machines and then let windows media or whatever build a playlist (since it already does tagging/organization and expose that to the PS3). And I wouldn't be surprised if there was existing functionality in a few other media players.

Share this post


Link to post
Share on other sites
EliotAugusto    100
I do thank you for the input. The only issue is that a raid setup is unavailable at this moment. Plus the challenge of something so oblique is something I can't resist. I'm going to remove the answered questions, thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this