Q: How to copy a raw file if a pdf file with the similar name exists. I am trying to have a rule run that when the PDF exists in the folder then to copy our .raw file of a similar name. But if the PDF doesn’t exist that means the run isn’t done yet. So we need it to scan the folder looking for a new pdf if there is one the .raw file will then copy. Right now we run a PowerShell to do the work but maybe there’s a better way.
A: So this would  mean:
 – Limagito Rule would scan for .raw files
 – If .raw files is found > scan different folder (and subfolders) for .pdf file with similar name
 – If pdf file exists then copy .raw file
Should be possible, we prepared some screenshots.
– Source Setup, we used a local Windows folder as Source:

– File Filter Setup:

 – Open our Pascal Script option:

– Enable and add the following ‘On Destinations‘ Pascal Script. Do not forget to adjust the pdf Search Path const, must end with a \
Var
  tmpFilename: String;
  tmpList: TStringList;
Const
  ctSearchPath = 'C:\Test\Nova\Pdf\';    
Begin
  psExitCode:= 0;
  tmpList := Nil;
  tmpFilename := ChangeFileExt(psFileName, '.pdf');
  // ... add your code here
  Try
    tmpList := psListFiles(ctSearchPath, tmpFilename, True);  
    If Assigned(tmpList) And (tmpList.Count > 0) Then
    Begin
      psExitCode := 1;
      psLogWrite(1, '', 'Found ' + tmpFilename + ' in ' + ctSearchPath);
    End
    Else
      psLogWrite(1, '', tmpFilename + ' not available yet in ' + ctSearchPath);
  Finally
    tmpList.Free;
  End;  
End.

– Enable File Memory (we only want to copy the same .raw file once)

– We used Copy as Function (that is why we enabled our File Memory option)

– Add Destination for .raw files

– RunTime Log result
+ at our first try the corresponding pdf was not available yet
 + at our second try we found the corresponding pdf file and copied the raw file

#filetransfer #mft #filemanagement
 If you need any info  about this ‘similar name exists’ request, please let us know.
Best regards,
Limagito Team



















