Copying files from a dynamic location

xzibited2

Active member
Joined
Jul 9, 2008
Messages
26
Programming Experience
1-3
I'm developing an application which relies on several files to be copied over to a specific location on the users hard drive ("C:\test\") when they run the program for the first time, and am having a hard time wrapping my head around how to account for the fact that the original location may be in a different location for each user.

Any ideas for either getting the path where the files would be and then copying them to the desired destination?
 
It depends where the files are. If they could be anywhere then the user will have to select the path, using one or more of the FolderBrowserDialog, OpenFileDialog and SaveFileDialog. If the files are in a standard location then you would use either Environment.GetFolderPath or My.Computer.FileSystem.SpecialDirectories.

Also, it's not a good idea to create a folder in the root of the C drive. Not every user has permission to write there for a start. If your application needs to store data then it should use the standard Windows Application Data folder, the path of which you can get using my earlier suggestion.
 
Back
Top