Peter C 0 Posted 9 hours ago Android 14 Delphi 12 Current I'm trying to copy from TPath.GetPublicPath + '/diary' to TPath.GetSharedDocumentsPath + '/backup'. In the TPath.GetPublicPath + '/diary' I have some txt files that I wish to copy to TPath.GetSharedDocumentsPath + '/backup'. When I execute this code it works perfectly, no issues( takes around 2~3sec depending on how many txt files there are to transfer ). But if I repeat the process, nothing happens. It executes and completes instantly. So I manually deleted all the files in the TPath.GetSharedDocumentsPath + '/backup' Folder to see if this was the case. Executed the code, same result, nothing is copied. So then I restarted the phone. Code executes perfectly and all files copy. Try again and back to square 1. If my App creates another txt file, and then executes said code, only the newly created file copies across! Even if I take the Thread Instance out and replace MyThread.Start with TDirectory.Copy( MASTER_PATH, BACKUP_PATH ) the same issue occurs. Am I missing something here?( Well obviously otherwise......) procedure TSERTEC_DIARY.FormCreate(Sender: TObject); begin MASTER_PATH := TPath.GetPublicPath + '/diary'; ARCHIVE_PATH := MASTER_PATH + '/archive'; BACKUP_PATH := TPath.GetSharedDocumentsPath + '/backup'; end; procedure TMyBackgroundThread.Execute; begin TDirectory.Copy( MASTER_PATH, BACKUP_PATH ); end; procedure TSERTEC_DIARY.lbBACKUPClick(Sender: TObject); var MyThread: TMyBackgroundThread; begin MyThread := TMyBackgroundThread.Create(True); // Create suspended MyThread.FreeOnTerminate := True; // Auto-free thread when done rcPopup.Visible := false; rcPopup.Opacity := 0; if TDirectory.Exists( BACKUP_PATH ) then begin try try ListView1.Opacity := 0.5; bkActivityCircle.Visible := true; bkActivityFloatAni.Enabled := true; MyThread.Start; // Start the background thread except ShowMessage('Incorrect source path or destination path'); end; finally ListView1.Opacity := 1; bkActivityCircle.Visible := false; bkActivityFloatAni.Enabled := false; ShowMessage('Backup Complete...'); end; end else begin try try TDirectory.CreateDirectory( BACKUP_PATH ); except ShowMessage('Unable to create path'); end; finally try try ListView1.Opacity := 0.5; bkActivityCircle.Visible := true; bkActivityFloatAni.Enabled := true; MyThread.Start; // Start the background thread except ShowMessage('Incorrect source path or destination path'); end; finally ListView1.Opacity := 1; bkActivityCircle.Visible := false; bkActivityFloatAni.Enabled := false; ShowMessage('Backup Complete...'); end; end; end; end; Share this post Link to post