Sign in to follow this  
Followers 0
Odewallrus

FileMove (intermitently) not working in my script any longer

3 posts in this topic

I have this script functional for some time now and recently it has stopped functioning on the FileMove. I have tried FileCopy with the same results. I originally had the FileMove going to a UNC path with no problems. During testing I set it to a mapped drive. When testing this by running the script sometimes it works sometimes it does not. I had this running from a scheduled task in windows for over a year with minimal to no problems. The task has correct credentials and run with highest privileges set. The destination share is on a NAS and has been verified to have proper privileges. You can manually create directories and copy manually with no issues. I have looked up and down this site and nothing seems to address this exact ally. Please help…

;~ completes a dirmove or filemove of the collected/zipped files based on the ini file, archiving them to a server share
For $h = 1 to $sActSec[0][0]
If $sActSec[$h][4] = 1 And FileExists($sActSec[$h][10]) then
  $sDirSize = DirGetSize($sTmpRoot & '\' & $sDTStamp & '\' & $sActSec[$h][0], 1)
  $sFileSize = FileGetSize($sActSec[$h][10])
  FileWriteLine($sLogFile, '     ' & $sActSec[$h][0] & ' Section archive:')
  FileWriteLine($sLogFile, '     Files: ' & $sDirSize[1])
  FileWriteLine($sLogFile, '     Origional directory size (MB): ' & Round($sDirSize[0] / 1048576, 1))
  FileWriteLine($sLogFile, '     Local compressed file size (MB): ' & Round($sFileSize / 1048576, 1))
  $Answer = FileMove($sActSec[$h][10], $sSrvShare & '\' & $sActSec[$h][3] & '\',8)
  If $answer = 1 then
   FileWriteLine($sLogFile, 'SUCCESS-          FileMove ' & $sActSec[$h][10] & ' ' & $sSrvShare & '\' & $sActSec[$h][3] & '\')
   $answer = DirRemove($sTmpBaseDir & '\' & $sActSec[$h][0],1)
    If $answer = 1 then FileWriteLine($sLogFile, 'SUCCESS-         DirRemove ' & $sTmpBaseDir & '\' & $sActSec[$h][0])
    If $answer = 0 Then FileWriteLine($sLogFile, 'FAILED-           DirRemove ' & $sTmpBaseDir & '\' & $sActSec[$h][0])
   FileWriteLine($sLogFile, @CRLF)
  ElseIf $answer = 0 then
   FileWriteLine($sLogFile, 'FAILED-            FileMove ' & $sActSec[$h][10] & ' ' & $sSrvShare & '\' & $sActSec[$h][3] & '\')
   FileWriteLine($sLogFile, @CRLF)
  EndIf
ElseIf FileExists($sTmpBaseDir & '\' & $sActSec[$h][0] & '\') Then
  $sDirSize = DirGetSize($sTmpRoot & '\' & $sDTStamp & '\' & $sActSec[$h][0], 1)
  FileWriteLine($sLogFile, '     ' & $sActSec[$h][0] & ' Section archive:')
  FileWriteLine($sLogFile, '     Files: ' & $sDirSize[1])
  FileWriteLine($sLogFile, '     Origional directory size (MB): ' & Round($sDirSize[0] / 1048576, 1))
  $Answer = DirMove($sTmpBaseDir & '\' & $sActSec[$h][0], $sSrvShare & '\' & $sActSec[$h][3] & '\' & $sActSec[$h][3] & '_' & $sDTStamp)
  If $answer = 1 then FileWriteLine($sLogFile, 'SUCCESS-           DirMove ' & $sTmpBaseDir & '\' & $sActSec[$h][0] & ' ' & $sSrvShare & '\' & $sActSec[$h][3] & '\' & $sActSec[$h][3] & '_' & $sDTStamp)
  If $answer = 0 then FileWriteLine($sLogFile, 'FAILED-         DirMove ' & $sTmpBaseDir & '\' & $sActSec[$h][0] & ' ' & $sSrvShare & '\' & $sActSec[$h][3] & '\' & $sActSec[$h][3] & '_' & $sDTStamp)
  FileWriteLine($sLogFile, @CRLF)
EndIf
$pbArchivePercent = $pbArchivePercent + $pbArchiveStep
GUICtrlSetData($pb, $pbArchivePercent)
Next

Share this post


Link to post
Share on other sites



sorry it took so long to respond....

$sActSec[$h][10] = full path to a zip file if the option to compress the source files has been set.

ex. C:LogArchive2012-05-22_08-58-16_ComputernameSourceDirectory_2012-05-22_08-58-16_Computername.zip

$sSrvShare & '' & $sActSec[$h][3] & '' = LogServerShare & '' & OrigionalDirectoryName & ''

$sSrvShare = LOGSERVERARCHIVE $sActSec[$h][3] = PBWEB

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0