Yes Glenn, I agree with you 100%. The point of a UDF is to have one block of code that can be called repeatedly. Quite a few of my UDF's are used and re-used quite a bit.

This is what prompted the question as I saw no point in these particular UDF's where effectively I am rewriting the code over and over again with some minute changes.

I have just realised that your action example is very similar to my case function that I have, so I have used the case function so as to reduce the number of If, else endif statements.

I ended up with this:

 Code:
;================================================================================================
;   This function checks the file time and date and updates files if both files are not the same time
;================================================================================================

Function filesametime($Installs, $DestDir, $File, $Value, $Action)

$Value = COMPAREFILETIMES ($Installs + $File, $Destdir + $File)

SELECT

  Case $Action = 1   ; copies file if not same time
if $Value <> 0
   ? "Running Action one"
    copy $Installs $DestDir /s
Else Endif

  Case $Action = 2   ; remove subdirectory and create new directory and updates only if source file is newer than dest file
  if $Value = 1 or $Value = -3
    ? "Running Action two" 
    RD $Destdir /S
    MD $DestDir
   ? "Copying Files to Install $ProgorProfile"
    copy $Installs $DestDir /s	
	else endif
  
  ENDSELECT

EndFunction



This is better as it will cut down on the repetitive coding. The common coding will come in handy with the readline file UDF. I don't know why I didn't think of using a case in the UDF!

Thank you.