Created
July 9, 2018 14:21
-
-
Save vitorebatista/bacae31b17fe3f46cdc2b27d42b04235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User Function TestTarThread() | |
Local nThread | |
For nThread := 1 To 2 | |
StartJob('U_TestTar', GetEnvServer(), .F.,) | |
Next nThread | |
Return | |
User Function TestTar() | |
Local cThreadId := AllTrim( Str( ThreadId() ) ) | |
Local cBarra := If(isSRVunix(),"/","\") | |
Local cCurDir := CurDir() + If(cBarra $ CurDir(), "" , cBarra ) | |
Local cTmpDir := "testtar" + cThreadId + cBarra | |
Local cFile1 := cCurDir + cBarra + cTmpDir + "file1.json" | |
Local cFile2 := cCurDir + cBarra + cTmpDir + "file2.json" | |
Local cFile3 := cCurDir + cBarra + cTmpDir + "file3.json" | |
Local aFiles := { cFile1, cFile2, cFile3 } | |
Local cTarFile := cCurDir + cTmpDir + 'tarfile.tar' | |
Local cTarGzFile := cCurDir + cTmpDir + 'targzfile.tar.gz' | |
Local nX | |
If !ExistDir( cCurDir + cTmpDir ) | |
MakeDir( cCurDir + cTmpDir ) | |
EndIf | |
For nX := 1 To 100 | |
Printf(cValtoChar(nX)) | |
nFile1 := FCreate( cFile1 ) | |
nFile2 := FCreate( cFile2 ) | |
nFile3 := FCreate( cFile3 ) | |
FWrite( nFile1, '[ ]' ) | |
FWrite( nFile2, '[ ]' ) | |
FWrite( nFile3, '[ ]' ) | |
FClose( nFile1 ) | |
FClose( nFile2 ) | |
FClose( nFile3 ) | |
//Sleep(1000) | |
TarCompress( aFiles, cTarFile) | |
GZCompress( cTarFile, cTarGzFile) | |
FErase(cFile1) | |
FErase(cFile2) | |
FErase(cFile3) | |
FErase(cTarFile) | |
FErase(cTarGzFile) | |
Next nX | |
DirRemove( cCurDir + cTmpDir ) | |
Return | |
Static Function printf(cLog) | |
Return conout("["+time()+" - "+cValToChar(ThreadId())+"] " + cLog) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
O erro gerado é: