Copy Files and Folders from CURRENT directory to User Home Folder VB.Net

~OSD~ 2,196 Reputation points
2020-12-04T09:00:50.813+00:00

Hi,

Is it possible to use "Current Directory" as source (instead of full /absolute path) to copy file /folder to current user profile?

Source: C:\myData\Backups\Latest**UserBackup**\SavedData\StdDoc.txt
<Instead of using the whole path, can we limit to the current directory, In my case it's UserBackup where the VB app should run>
Possibility to define source as: CurrentDir\SavedData\StdDoc.txt ?
Destination: %UserName%\Documents\StdDoc.txt

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,741 questions
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. ~OSD~ 2,196 Reputation points
    2020-12-08T11:52:45.96+00:00

    I am working with Single File /Application and yes, it's Windows Application Forms application /Desktop application.


  2. Cory Smith 11 Reputation points
    2020-12-08T14:53:36.267+00:00

    If a single file .NET Framework 4.x WinForms application, it should work. If not .NET Framework 4.x (or prior), then things are a bit more complicated (but can be done).

    The suggestion by anonymous user of prompting the user is also a very good option as this provides flexibility in allowing the application to "launch from anywhere". With that said, this suggestion also doesn't really solve the problem as you are still left with two options:

    • default to "nothing" and force your end-user to pick before your applications related functionality does anything...
    • determine a suitable (most likely relevant) default set of paths.

    As an end-user, I like the idea of things "just working" out of the box and, as anonymous user suggests, given the ability to modify these values to suit my particular needs.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.