Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:05:18+00:00 2026-06-13T13:05:18+00:00

So i am developing an Desktop cleaner which moves the items depending on the

  • 0

So i am developing an Desktop cleaner which moves the items depending on the extension to an specific directory (the one that is being cleaned)

The user defines the names of the folder which the items will be placed.

But the code to move the files doesn’t work properly.

Private Sub FlowButton1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FlowButton1.Click
    If CheckBox1.Checked Then
        Dim folderPathTextBox = options.TextBox1.Text
        Dim files() As String
        files = System.IO.Directory.GetFiles(options.FolderBrowserDialog1.SelectedPath, "*.txt")

        For Each file As String In files
            System.IO.File.Copy(file, options.TextBox1.Text & options.TextBox8.Text & options.TextBox2.Text & System.IO.Path.GetFileName(file))
        Next

    Else
    End If
  • options.TextBox1.Text = Directory selected using Folder dialog E.G: “C:\directory”

  • options.TextBox8.Text = slash to separate = “C:\directory\”

  • options.TextBox2.Text = Folder name determined by user E.G Images = “C:\directory\images”

I also want the code to check if the folder exist if not create it .

Thanks any help is appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:05:19+00:00Added an answer on June 13, 2026 at 1:05 pm

    Some ideas to help you organize/simplify your code:

    1. Name your TextBox‘es properly. If you cannot do it, declare meaningful local variables and use that in code. It would greatly improve readability.
    2. Use Path.Combine to join C:\directory and Images together. Get rid of TextBox8.
    3. I think you can safely drop System.IO.Path.GetFileName(file) part as well, should be able to just use directory as a copy target. File.Copy expects a file name as a second parameter. You would need to use Path.Combine overload that accepts 3 parameters, and combine base path + user specified folder + the file name.
    4. When using File.Copy, make sure you don’t have this file in target already. According to MSDN, Overwriting a file of the same name is not allowed.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a desktop application in WPF, application that is manipulating a considerable amount
I'm developing a desktop Mac OS X App that saves its very simple data
I am developing a Java Desktop Application and want a light database that can
Am developing a desktop app that will serve as message notifier, just like yahoo
I'm developing a desktop app. that should work over Internet and communicate with remote
Im developing desktop java application using maven. I got a *.properties file that I
I am developing a Desktop application which we install on client machines but it
I am in the process of developing a desktop application that needs a database.
I'm developing a desktop application using java + SWT/JFace, which I'm not very familiar.
I am developing a desktop application with a MainForm that's grown rather large. There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.