home bbs files messages ]

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,670 of 42,547   
   andrewniebling@gmail.com to All   
   Re: MOVE cmd and output redirection   
   29 May 13 19:15:13   
   
   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\SurveyPlans\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\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \SurveyPlanLink.Log"   
   Move /Y "P:\ABRplans\Survey Plans\SP253700.pdf" "G:\QRData\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \SurveyPlanLink.Log"   
   Move /Y "P:\ABRplans\Survey Plans\SP230914.pdf" "G:\QRData\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \SurveyPlanLink.Log"   
   Move /Y "P:\ABRplans\Survey Plans\RP612595.pdf" "G:\QRData\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \SurveyPlanLink.Log"   
   Move /Y "P:\ABRplans\Survey Plans\RP152112.pdf" "G:\QRData\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \SurveyPlanLink.Log"   
   Move /Y "P:\ABRplans\Survey Plans\LN1264.pdf" "G:\QRData\SurveyPlans\Linked\"   
   >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plans\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\Surve   
   Plans\Linked\" >> "G:\zGIS_Data_Editing\QR_Log_Files\Survey_Plan   
   \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.   
      
   --- 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