diff --git a/matlab/parallel/dynareParallelDir.m b/matlab/parallel/dynareParallelDir.m
index 34aa98846b762d8e9bf404a0cd6ba44e4a31c366..60c2900ec6fba8b5577526c9cec2017d1fe73df3 100644
--- a/matlab/parallel/dynareParallelDir.m
+++ b/matlab/parallel/dynareParallelDir.m
@@ -40,7 +40,7 @@ for indPC=1:length(Parallel),
             else
                 [check, ax]=system(['ssh ',Parallel(indPC).UserName,'@',Parallel(indPC).ComputerName,' ls ',Parallel(indPC).RemoteDirectory,'/',PRCDir,'/',filename]);
             end
-            if check ~ 0;
+            if check ~= 0 || ~isempty(strfind(ax,'No such file or directory'));
                 ax=[];
             end
         else
@@ -50,7 +50,7 @@ for indPC=1:length(Parallel),
                 % It is necessary to capture the ls warning message and properly manage the jolly char '*'!
                 [check ax]=system(['ls ' ,filename, ' 2> OctaveStandardOutputMessage.txt']);
                 
-                if check ~ 0;
+                if check ~= 0 || ~isempty(strfind(ax,'No such file or directory'));
                     ax=[];
                 end
             else