MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / CopyDirectory

Function CopyDirectory

sourcecommon/utils.cpp:300–337  ·  view source on GitHub ↗

--------------------------------------------------------------------------- �������� ����� �� ����� szFrom �� ����� szMask � ����� szTo �� ����� ���������������

Source from the content-addressed store, hash-verified

298//---------------------------------------------------------------------------
299// �������� ����� �� ����� szFrom �� ����� szMask � ����� szTo �� ����� ���������������
300bool CopyDirectory(char * szFrom, char * szMask, char * szTo)
301{
302 bool bRetVal = true;
303 HANDLE handle;
304 WIN32_FIND_DATA FD;
305 //
306 char sfile[MN];
307 char dfile[MN];
308 wsprintf(sfile, "%s%s", szFrom, szMask);
309 //
310 handle = FindFirstFile(sfile, &FD);
311 //
312 if( handle != INVALID_HANDLE_VALUE )
313 do
314 {
315 wsprintf(sfile, "%s%s", szFrom, FD.cFileName);
316 wsprintf(dfile, "%s%s", szTo, FD.cFileName);
317 //
318 if( FD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
319 {
320 // !="." && !=".."
321 if( strcmpi(FD.cFileName, ".") && strcmpi(FD.cFileName, "..") )
322 {
323 if( ::GetFileAttributes(dfile)==0xFFFFFFFF ) ::CreateDirectory(dfile, NULL);
324 TerminateDirectory(sfile);
325 TerminateDirectory(dfile);
326 if( !CopyDirectory(sfile, szMask, dfile) ) bRetVal = false;
327 }
328 }
329 else
330 {
331 if( !::CopyFile(sfile, dfile, FALSE) ) bRetVal = false;
332 }
333 //
334 } while( FindNextFile(handle, &FD) );
335 FindClose(handle);
336 return bRetVal;
337}
338//---------------------------------------------------------------------------
339#if !defined(DANFOSS)
340void ReportError(char *fmt, ...)

Callers

nothing calls this directly

Calls 1

TerminateDirectoryFunction · 0.85

Tested by

no test coverage detected