Var iPathList: Integer; tmpPathSource, tmpPathDestination: String; tmpPathList, tmpFileList: TStringList; Const ctSource = 'C:\Test\In\Empty\'; ctDestination = 'C:\Test\Out\Empty\'; Begin psExitCode:= 0; // ... add your code here tmpPathList := TStringList.Create; Try psListPaths(ctSource, '*.*', 0, tmpPAthList); For iPathList := (tmpPathList.Count-1) Downto 0 Do Begin tmpPathSource := tmpPathList.Strings[iPathList]; psLogWrite(1, '', 'Source Path: ' + tmpPathSource); tmpPathDestination := psStringReplace(tmpPathSource, ctSource, ctDestination); // Check if files exist in source tmpFileList := psListFiles(tmpPathSource, '*.*', True); Try If tmpFileList.Count = 0 Then Begin If psCreatePath(tmpPathDestination) Then Begin psLogWrite(1, '', 'Created Successfully at Destination: ' + tmpPathDestination); If RemoveDir(tmpPathSource) Then psLogWrite(1, '', 'Removed Successfully from Source: ' + tmpPathSource) Else psLogWrite(1, '', 'Remove Error from Source: ' + tmpPathSource); End Else psLogWrite(1, '', 'Create Error in Destination: ' + tmpPathDestination); End; Finally tmpFileList.Free; End; End; Finally tmpPathList.Free; End; End.