Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 40,669 of 42,547    |
|    Todd Vargo to andrewniebling@gmail.com    |
|    Re: MOVE cmd and output redirection    |
|    29 May 13 23:30:46    |
   
   From: tlvargo@sbcglobal.netz   
      
   On 5/29/2013 10:15 PM, andrewniebling@gmail.com wrote:   
   > This is the sub of the mapbasic program that creates the batch file and then   
   executes it, then deletes the batch file once it has copied the files.   
   >   
   >   
   > Sub pdfcopy   
   > '***********************   
   > 'Subroutine:pdfcopy *   
   > 'Called By:process *   
   > 'Description: *   
   > '***********************   
   >   
   > Dim _1 as String   
   > Dim fpath as String   
   > Dim tpath as String   
   > Dim doscmd as String   
   > doscmd = "Move /Y "   
   > fpath = """P:\ABRplans\Survey Plans\"   
   > tpath = """G:\QRData\SurveyPlans\Linked\"""   
   >   
   >   
   > ' Delete PLACEHOLDER File   
   > '************************   
   > If Fileexists (PLACEHOLDER) Then   
   > Kill PLACEHOLDER   
   > End If   
   >   
   > 'sort tblSurveyPlan to remove duplicates   
   > '***************************************   
   > Select * from tblSurveyPlan group by Plan_Nš into tblPlan   
   > Open file REPORT_FILE for append as #1   
   > Call PrintMessage("Create and run batch file ...")   
   > Close file #1   
   > Open file SP_BATCH for append as #2   
   > print #2, "@echo off"   
   > print #2, "cls"   
   > print #2, ""   
   >   
   > Fetch first from tblPlan   
   > Do while not eot(tblPlan)   
   > _1 = tblPlan.col1   
   > print #2, doscmd & fpath & _1 & ".pdf""" & " " & tpath & " >> "& """" &   
   REPORT_FILE &""""   
   > Fetch next from tblPlan   
   > Loop   
   > print #2, "Echo SP BAT Log >> G:\zGIS_Data_Editing\QRData\Surv   
   yPlans\BAT.LOG"   
   > Close file #2   
   >   
   > 'Run Batch - Note That You Wont See Bat File Running Unless You Change 0 to 1   
   > '****************************************************************************   
   > COMMID=Winexec("G:\zGIS_Data_Editing\QRData\SurveyPlans\SP_Batch.bat", 1)   
   > Do   
   > Loop While Not Fileexists (PLACEHOLDER)   
   > Kill SP_BATCH   
   > Kill PLACEHOLDER   
   > Open file REPORT_FILE for append as #1   
   > Call PrintMessage("Done, pdf files copied to link dir in - " & Str$(Timer()   
   - glTimer) & " secs"& CR)   
   >   
   > End Sub ' pdfcopy   
   >   
   > This line:   
   >   
   > print #2, doscmd & fpath & _1 & ".pdf""" & " " & tpath & " >> "& """" &   
   REPORT_FILE &""""   
   >   
   > will create the file called "SP_Batch.bat" and contain the following:   
   >   
   > @echo off   
   > cls   
   >   
   > Move /Y "P:\ABRplans\Survey Plans\SP230852.pdf" "G:\QRData\Sur   
   eyPlans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Pl   
   ns\SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\SP253700.pdf" "G:\QRData\Sur   
   eyPlans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Pl   
   ns\SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\SP230914.pdf" "G:\QRData\Sur   
   eyPlans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Pl   
   ns\SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\RP612595.pdf" "G:\QRData\Sur   
   eyPlans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Pl   
   ns\SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\RP152112.pdf" "G:\QRData\Sur   
   eyPlans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Pl   
   ns\SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\LN1264.pdf" "G:\QRData\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\RM76.pdf" "G:\QRData\SurveyPlans\Linked\"   
   >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plans\SurveyPlanLink.Log"   
   > Move /Y "P:\ABRplans\Survey Plans\SP229947.pdf" "G:\QRData\Sur   
   eyPlans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Pl   
   ns\SurveyPlanLink.Log"   
   > Echo SP BAT Log >> G:\zGIS_Data_Editing\QRData\SurveyPlans\BAT.LOG   
   >   
   > this is a cut back version of the batch file as there is another 100 or so   
   files to move so all file paths are exactly the same only the file name of the   
   pdf changes. It all works as it should I just cant get the log file to list   
   the files that were    
   copied over.   
   >   
      
   The generated batch appears to have correct batch syntax. (Thank you for   
   pruning it to just a few lines.)   
      
   I know this is not the problem but, the user manual that I downloaded is   
   version 9 but does not have the Winexec method so I can not tell if the   
   ", 1" is a window style or wait to return directive.   
      
   Does your mapbasic code contain any OERN lines? If so, disable them.   
      
   I'm not able to see your system so I don't know what exists before the   
   batch runs, if any files are moved, or if there are any error messages.   
      
   Does the folder G:\QRData\SurveyPlans\Linked\ exist and is it empty   
   before running the batch?   
      
   Same for G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plans\?   
      
   Do the MOVE commands produce any error messages? Try adding " 2>&1" to   
   the end of the move commands to capture any error messages to the log file.   
      
   --   
   Todd Vargo   
   (Post questions to group only. Remove "z" to email personal messages)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca