I have a project in Delphi 2010 in which I use to compress and create backups of WinRAR, through the following code I can compress the following folder teste3
:
AFile := 'C:\teste1\teste2\teste3';
LocateFile := 'C:\Users\Desktop\BACKUPS\'+ FormatDateTime('yyyy-mm-dd', Now) +'.rar';
winexec(PAnsiChar(AnsiString('"C:\Program Files\WinRAR\WinRAR.exe" a '+ LocateFile +' "'+ AFile + '"')), SW_HIDE);
But the compressed file is not showing up as I intended with the folder teste3
, so I leave here the example of what I want.
This is the directory of the teste3
folder:
C: \ test1 \ test2 \ test3
Structure:
c:
teste1
teste2
teste3
exemplo1.txt
exemplo2.txt
exemplo3.txt
ficheiro1.txt
ficheiro1.txt
When compressed within .rar
I have:
ficheiro.rar
teste1
teste2
teste3
exemplo1.txt
exemplo2.txt
exemplo3.txt
What I want:
ficheiro.rar
teste3
exemplo1.txt
exemplo2.txt
exemplo3.txt
If anyone can contribute anything thank you.