trompé de langage?
Private Function BackupFiles(ByVal Fast As Boolean) l_folder.Text = "Test" Sleep(1000) totalfiles = 0 For i = 0 To folderfiles.Length - 1 folderfiles(i) = 0 Next For i = 0 To backups.Length - 1 If Not backups(i).Chemin Is Nothing Then For Each file In My.Computer.FileSystem.GetFiles(backups(i).Chemin, backups(i).getNiveau, backups(i).fichiersTypes) totalfiles += 1 folderfiles(i) += 1 Next Else Exit For End If Next i_master = 1 p_master = 0 p_folder = 0 pb_master.Maximum = totalfiles 'Exit Sub Try Dim test = My.Computer.FileSystem.GetDirectories(targetFolder) Catch ex As Exception My.Computer.FileSystem.CreateDirectory(targetFolder) End Try For i = 0 To backups.Length - 1 If Not backups(i).Chemin Is Nothing Then p_folder = 0 i_folder = 1 pb_folder.Maximum = folderfiles(i) l_folder.Text = "Dossier en cours : " & targetFolder & "" & backups(i).Nom & "" Dim fichiers = My.Computer.FileSystem.GetFiles(backups(i).Chemin, backups(i).getNiveau(), backups(i).fichiersTypes) For Each file As String In fichiers Dim path = file.Replace(backups(i).Chemin & "", "") currentfiles += 1 p_folder += i_folder p_master += i_master l_file.Text = "Fichier copié : " & file pb_folder.Value = p_folder pb_master.Value = p_master l_number.Text = currentfiles & "/" & totalfiles l_pb_master.Text = Math.Floor((p_master / totalfiles) * 100) & "%" l_pb_folder.Text = Math.Floor((p_folder / folderfiles(i)) * 100) & "%" Try 'My.Computer.FileSystem.CopyFile(file, targetFolder & "" & backups(i).Nom & "" & path) Catch ex As Exception MsgBox("Error : " & ex.Message) End Try Next Else Exit For End If Next 'BackConsole.Show() 'BackConsole.tb_console.Text += vbNewLine & "--- BACKUP TERMINE ---" MsgBox("Backup terminé !", MsgBoxStyle.Information) pb_master.Value = 0 pb_folder.Value = 0 Return Nothing End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question