teodoric666 Posted April 19 Share Posted April 19 I made an exe to save the AppData directory it works quite well I would like to add a progress bar but I am unable to, I don't have the level can anyone help me if not is not too complicated for you of course Thanks a lot expandcollapse popup#include <FileConstants.au3> #include <File.au3> #include <Date.au3> $date = @MDAY & "-" & @MON Local $AppDataPath = @AppDataDir Local $LocalAppDataPath = @LocalAppDataDir Local $BackupPath = "D:\" & $date & '.\Backup' Local $Search = FileFindFirstFile($AppDataPath & "\*.*") FileClose($Search) ; Copie récursive des fichiers et dossiers Func CopyFolder($SourcePath, $DestPath) Local $Search = FileFindFirstFile($SourcePath & "\*.*") If $Search = -1 Then Return Local $CopiedFiles = 0 While 1 Local $File = FileFindNextFile($Search) If @error Then ExitLoop If Not @extended Then ; Fichier trouvé, copie vers le répertoire de sauvegarde FileCopy($SourcePath & "\" & $File, $DestPath & "\" & $File, $FC_OVERWRITE) $CopiedFiles += 1 ElseIf StringInStr(FileGetAttrib($SourcePath & "\" & $File), "D") Then ; Dossier trouvé, récursion If $File <> "." And $File <> ".." Then DirCreate($DestPath & "\" & $File) CopyFolder($SourcePath & "\" & $File, $DestPath & "\" & $File) EndIf EndIf WEnd FileClose($Search) EndFunc ; Début de la copie des répertoires AppData, Local et Roaming CopyFolder($AppDataPath, $BackupPath &"\AppData\Roaming") CopyFolder($LocalAppDataPath, $BackupPath &"\AppData\Local") ; Affichage du message à la fin de la copie MsgBox(64, "Copie terminée", "La sauvegarde des répertoires Roaming , Local est terminée.") Link to comment Share on other sites More sharing options...
Solution Nine Posted April 19 Solution Share Posted April 19 (edited) Salutations @teodoric666. Here how I would do it : #include <File.au3> Local $sDate = @MDAY & "-" & @MON Local $sSource = "C:\Users\" & @UserName & "\AppData\" Local $sBackupPath = "D:\" & $sDate & '\Backup\' Local $aList = _FileListToArrayRec($sSource, "*||LocalLow", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_RELPATH) ProgressOn("Backup " & $sDate, "0% completed") Local $nProgress, $nPrec For $i = 1 To $aList[0] FileCopy($sSource & $aList[$i], $sBackupPath & $aList[$i], $FC_OVERWRITE + $FC_CREATEPATH) $nProgress = Int($i / $aList[0] * 100) If $nProgress = $nPrec Then ContinueLoop ProgressSet($nProgress, $nProgress & "% completed") $nPrec = $nProgress Next ProgressSet(100, "Backup completed") Sleep(2000) ProgressOff() Edited April 19 by Nine teodoric666 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
teodoric666 Posted April 20 Author Share Posted April 20 Very thank's Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now