2

I'm building a repository folder and file structure with many dependencies in version control using .NET for our data warehouse. Currently I have code to create dummy files and folders with C# code (see below). However, there are objects being shared. So I'd like to create shortcuts to Windows files and shortcuts to Windows folders as well as files. What would the code look like in C# to accomplish this?

Create Folder via C#.NET code:

string activeDir = @"C:\Source\EDW\dw-objects\trunk\table-objects";
string objectName = reader[0].ToString();
string newPath = System.IO.Path.Combine(activeDir, objectName);
System.IO.Directory.CreateDirectory(newPath);

Code varies depending on files based on format

JustBeingHelpful
  • 18,332
  • 38
  • 160
  • 245

2 Answers2

4

Please use the ShellClass to create shortcuts also you will need to get the special directory from desktop using Environment.SpecialFolder.DesktopDirectory

A very good example showing step by step can be found here http://www.codeproject.com/Articles/146757/Add-Remove-Startup-Folder-Shortcut-to-Your-App

HatSoft
  • 11,077
  • 3
  • 28
  • 43
  • In combination with [How do I create shortcuts for my application](http://stackoverflow.com/q/1036093/3090544) it is good to create shortcuts in AllUsers Desktop and Startup folder. – MarkusEgle Apr 08 '14 at 09:07
2

Have a look at This Article it shows you how to manipulate NTFS Juncture points using c#. Because you will want to access the folders you need to have juncture points instead of shrotcuts since one is followed by machine processing and one isn't.

John Mitchell
  • 9,653
  • 9
  • 57
  • 91