Hello the gurus...

Can anyone suggest the easiest way of checking files in a location on the 
server for instance, comparing the modification dates with the files on the 
user's disk and if the one on the server is later than one on user's disk, it 
copies the file?

I have a working script but it's real beginner stuff and the issue I'm having 
is that the server location needs a username and password before the script can 
do its thing!

I was initially using a nice small script using URL & binfile but one cannot 
compare the modificiation date on the file (As far as I know anyway)
I have included my script for your entertainment...

on checkFiles
  
  put empty into tempMessage
  put empty into tLocalPath
  put empty into tServerPath
  put the effective filename of this stack into tLocalPath
  set the itemDelimiter to "/"
  put "" into item -1 of tLocalPath

  put the serverFileDownloadURL of this cd into tURL                       
---(http://ipaddress/netcaresource/filesToDownload)
  put the serverFileDownloadPath of this cd into tServerPath             
---(\\ipaddress\netcaresource\filesToDownload\)
  put folder_content(tServerPath) into Serverfiles
  put folder_content(tLocalPath) into Localfiles
  put the number of lines in Serverfiles into SLines
  put the number of lines in Localfiles into LLines
  repeat with i = 1 to SLines
    show group "updateGroup"
    doImBusy
    put the line i of Serverfiles into thisSLine
    replace "," with cr in thisSLine
    put first line of thisSLine into tempSFile
    put Localfiles into testLocal
    replace comma with space in testLocal
    if tempSFile is among the words of testLocal then 
      repeat with j = 1 to LLines
        put the line j of LocalFiles into thisLFile
        replace comma with cr in thisLFile
        put first line of thisLFile into tempLFile
        if tempSFile = tempLFile then --If the file names match
          if line 5 of thisSLine > line 5 of thisLFile then ---- If the server 
version is greater
            put "Updating...." into fld "theAction"
            put tempLFile into fld "theFileName"
            put tURL & tempSFile into pFileName
            put URL tURL into URL ("binfile:"&pFileName)
            put tServerPath&tempSFile into theFile
            put tLocalPath&tempSFile into tFileName
            revCopyFile theFile,tFileName --- Copy the file
            if the result is empty then
              put tempSFile & " File Updated Sucessfully..."&cr after 
tempMessage
            end if
          end if
        end if
      end repeat
    else ---- If the file does not exist at all
      put "Downloading...." into fld "theAction"
      put tempSFile into fld "theFileName"
      put tURL & tempSFile into pFileName
      put URL tURL into URL ("binfile:"&pFileName)
      put tServerPath&tempSFile into theFile
      put tLocalPath&tempSFile into tFileName
      revCopyFile theFile,tFileName -- Copy the file
      if the result is empty then
        put tempSFile & " This new file Added Successfully..."&cr after 
tempMessage
      end if
    end if
  end repeat
  doImNotBusy
  hide group "updateGroup"
end checkFiles

function folder_content tFolder
  put the directory into olddir
  set the directory to tFolder
  put the detailed files into tFiles
  set the directory to olddir
  return tFiles
end folder_content


Please if anyone has an easier way or is able to assist with authentication 
issue, I'll be most grateful!!!

Thanks
Regards
Nic
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#####################################################################################
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to