home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 68,072 of 68,980   
   Herbert Kleebauer to All   
   Re: move a fixed number of files between   
   05 Jul 23 22:22:18   
   
   From: klee@unibwm.de   
      
   On 05.07.2023 13:43, Jüri Tasuja wrote:   
      
   > Images are .jpg images from trail camera where camera was set to shoot 3   
   pictures in the row when activated. Camera saves all pictures in one folder.   
   Pictures have all different names e.g.   
   > "E:\IMG_0001.JPG"   
   > "E:\IMG_0002.JPG"   
   > "E:\IMG_0003.JPG"   
   > "E:\IMG_0004.JPG"   
   > "E:\IMG_0005.JPG"   
   > "E:\IMG_0006.JPG"   
   > "E:\IMG_0007.JPG"   
   > "E:\IMG_0008.JPG"   
   > "E:\IMG_0009.JPG"   
   > My thought was to somehow to store 3 images temporarily then compare their   
   sizes and then pass to right folder. At the moment images are sent straight to   
   the destination folder in the cycle.   
   > To explain why I need such sorting is that many times trail camera is   
   activated by wind movement and it creates lots of "empty" images without   
   animals. These empty 3 image sets are usually very similar in size maybe   
   differing 1 or 2 kB and thus    
   hopefully possible to sort out by image size condition.   
      
      
   @echo off   
   set SourceDir=E:\   
   set TargetDir1=E:\new1\   
   set TargetDir2=E:\new2\   
      
   set n=0   
   for /f %%i in ('dir /b /on "%SourceDir%*.jpg"') do call :sub %%i   
   goto :eof   
      
   :sub   
   set file1=%file2%   
   set size1=%size2%   
   set file2=%file3%   
   set size2=%size3%   
   set file3=%1   
   set size3=%~z1   
      
   set /a n=n+1   
   if not %n%==3 goto :eof   
   set n=0   
      
   echo compare file size of %file1% (%size1%) %file2% (%size2%) %file3% (%size3%)   
   set max=%size1%   
   if %size2% gtr %max% set max=%size2%   
   if %size3% gtr %max% set max=%size3%   
      
   set min=%size1%   
   if %size2% lss %min% set min=%size2%   
   if %size3% lss %min% set min=%size3%   
      
   set /a diff=max-min   
      
   if %diff% gtr 2000 (   
     move %file1% %TargetDir1%>nul   
     move %file2% %TargetDir1%>nul   
     move %file3% %TargetDir1%>nul   
     ) else (   
     move %file1% %TargetDir2%>nul   
     move %file2% %TargetDir2%>nul   
     move %file3% %TargetDir2%>nul)   
      
   --- 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