Loading ...
Sorry, an error occurred while loading the content.
 

Re: [BATCH WORLD] sorting files into folders

Expand Messages
  • sfingid
    ... insect ... per ... about ... sorting ... folder. ... a ... its ... egg ... egg ... go ... so if ... can ... Awesome. Thanks. -sfingid
    Message 1 of 5 , Mar 25, 2007
      --- In batchworld@yahoogroups.com, foxidrive <foxidrive@...> wrote:
      >
      > On Sun, 25 Mar 2007 20:00:32 -0000, "sfingid" <sfingid@...> wrote:
      >
      > >--- In batchworld@yahoogroups.com, foxidrive <foxidrive@> wrote:
      > >>
      > >> On Fri, 23 Mar 2007 04:23:02 -0000, "sfingid" <sfingid@> wrote:
      > >>
      > >> >
      > >> >
      > >> >A file-sorting problem. I have a digital camera attached to a
      > >> >microscope that is putting out picture files in the following
      > >format:
      > >> >
      > >> >name00001.bmp
      > >> >name00002.bmp
      > >> >etc
      > >> >
      > >> >The pictures are part of a time-lapse study we're doing of
      insect
      > >> >eggs developing. To maximize throughput we've set up a robotic
      > >> >microscope stage that moves up to 64 eggs, in order, into the
      > >field
      > >> >of view for a picture. Each egg gets photographed ~ 3 times
      per
      > >> >hour, which over the course of a 5 day experiment adds up to
      about
      > >> >30,000 picture files.
      > >> >
      > >> >Reconstructing movies of each individual egg will require
      sorting
      > >> >each Nth picture (i.e. 64th for 64 eggs) into a separate
      folder.
      > >> >Ideally I'd like to have a function to which I give a name and
      a
      > >> >total # of eggs (N), and the function then creates N folders
      > >> >(name01 ...nameN) and sorts each Nth file into the appropriate
      > >folder.
      > >>
      > >> I'm not clear on the requirement.
      > >>
      > >> You give a name and total egg count (64 for example) and want to
      > >create 64
      > >> folders? and sort the Nth file (1 and 64?) into which folders?
      > >>
      > >> Please be a little clearer in what you need to do.
      > >
      > >Yes, one folder per egg, with all pictures of that egg put into
      its
      > >folder. The problem is that successive pictures of a particular
      egg
      > >occur N files apart (where N is # of eggs). E.g., for the second
      egg
      > >I would want name00002.bmp, name00066.bmp, name00130.bmp, etc to
      go
      > >into a folder named, say, egg2. The folder egg3 gets
      > >name00003.bmp, name00067.bmp, name00131.bmp, etc.
      >
      > Gotcha.
      >
      > ATM this only echos the MD command and copy commands to the console
      so if
      > you're satisfied the counting and incrementing is accurate then you
      can
      > remove the echos and 'let her rip'. Requires W2K/XP
      >
      >
      > @echo off
      > setlocal enabledelayedexpansion
      > if %2.==. (
      > echo USAGE: %0 "foldername" number_of_eggs
      > echo.
      > echo avoid exclamation marks in the foldername
      > goto :EOF
      > )
      > set "name=%~1"
      > set eggs=%2
      > for /L %%a in (1,1,%eggs%) do (
      > set num=00%%a
      > set num=!num:~-2!
      > echo md "%name%!num!"
      > )
      > pause
      > set /a numpics=eggs*64
      > for /L %%a in (1,1,%eggs%) do (
      > for /L %%b in (%%a,64,%numpics%) do (
      > set num=00000%%b
      > set num=!num:~-5!
      > set foldernum=00%%a
      > set foldernum=!foldernum:~-2!
      > echo copy "oldfilenamename!num!.bmp" "%name%!foldernum!"
      > pause
      > )
      > )
      >

      Awesome. Thanks.

      -sfingid
    Your message has been successfully submitted and would be delivered to recipients shortly.