复制到新文件夹后删除所有文件

Delete all the files after copying in new folder

'Start Button' 执行以下操作:

  1. 检查 .blf 个文件的给定文件夹路径
  2. 将所有现有 .blf 文件复制到目标文件夹
  3. 在文本文件中显示文件夹的目录,即。正在创建文件的位置
  4. 显示复制现有文件的目录,即。到服务器
  5. 复制后从父文件夹中删除文件

我该怎么做第 5 点..我错在哪里?

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Const DestinationDirectory As String = "C:\Users\nha4abt\Desktop\Move_Here"
    'Show the parent folder path
    TextBox1.Text = "C:\Users\nha4abt\Desktop\Ahmad_examaning_folder"
    ' Show the destination folder path
    TextBox2.Text = DestinationDirectory
    For Each FileName As String In directory.GetFiles("C:\Users\nha4abt\Desktop\Ahmad_examaning_folder", "*.blf")
        File.Copy(FileName, Path.Combine(DestinationDirectory, Path.GetFileName(FileName)))
        ListBox1.Items.Clear()
        ListBox1.Items.Add(FileName)
    Next FileName

    For Each FileName In As String In directory.GetFiles("C:\Users\nha4abt\Desktop\Ahmad_examaning_folder", "*.blf")
        File.Delete(Path.GetFileName(FileName))
    Next FileName
End Sub

我这样做并得到了结果。这更像是一个愚蠢的错误。

  Const DestinationDirectory As String = "C:\Users\nha4abt\Desktop\Move_Here"
    'Show the parent folder path
    Const ParentDirectory As String = "C:\Users\nha4abt\Desktop\Ahmad_examaning_folder"
    TextBox1.Text = ParentDirectory
    ' Show the destination folder path
    TextBox2.Text = DestinationDirectory
    ListBox1.Items.Clear()
    For Each FileName As String In Directory.GetFiles(ParentDirectory, "*.blf")
        File.Copy(FileName, Path.Combine(DestinationDirectory, Path.GetFileName(FileName)))
        File.Delete(FileName)
        ListBox1.Items.Add(FileName)
    Next FileName

End Sub