Bonjour à tous,
Je fais appel à la communauté pour me permettre d'avancer dans mon script.
Je cherche à récupérer tous mes fichiers texte dans un fichier unique.
Le dossier "recup" s’installe dans C:\ ainsi que le fichier bigdata.txt.
Je me perds un peu dans le reste du code .
Merci, d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 Imports System Imports System.Text Imports System.IO Imports System.Collections.Generic Public Class Form1 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim sb As New StringBuilder() ' Imports System.Text For Each txtName As String In Directory.EnumerateFiles("C:\Users\hugo\Documents", "*.txt", SearchOption.AllDirectories) Using sr As New StreamReader(txtName) sb.Append(txtName.ToString()) sb.AppendLine("======") sb.Append(sr.ReadToEnd()) sb.AppendLine() sb.AppendLine() End Using Next Using outfile As New StreamWriter("C:\Recup" + "\bigdata.txt") outfile.Write(sb.ToString()) End Using End Sub End Class
Partager