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,075 of 68,980   
   =?UTF-8?B?SsO8cmkgVGFzdWph?= to Herbert Kleebauer   
   Re: move a fixed number of files between   
   06 Jul 23 03:59:19   
   
   From: tarbija6@gmail.com   
      
   On Wednesday, 5 July 2023 at 23:22:20 UTC+3, Herbert Kleebauer wrote:   
   > 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)   
      
   Many thanks for script! Unfortunately I can't get it working. I have tested it   
   and the script itself is working just perfectly but it fails when moving files   
   where it gives message "Access denied". I googled the problem and one   
   explanation is that when    
   source file is in use then "move" don't work so I changed "move" function with   
   "robocopy" and now it don't give any message but not moving the files.   
      
   robocopy %file1% %TargetDir1%>nul /A /MOV   
      
   I also tried to run as administrator but then script failed to find file size   
   "set size3="   
   Also it seems that %~z1 works only with local folders and failed with my   
   external hard drive to give file size.   
   Could you possibly have idea why it's not moving files.    
      
   --- 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