Windows mass copy files with same name in differnt folders

I have files existing with same names in the folders with date as display below

c:\2010-09-10    <==== folder
   arr1.jpg
   arr2.jpg
   arr3.jpg
   arr4.jpg
c:\2010-09-09   <==== folder
   arr1.jpg
   arr2.jpg
c:\2010-09-08     <==== folder
   arr2.jpg
   arr3.jpg
   arr4.jpg
   arr5.jpg
   arr8.jpg
   arr9.jpg
   arr10.jpg
   arr11.jpg
 c:\2010-09-07   <==== folder
   arr2.jpg
   arr3.jpg
   arr4.jpg
   arr10.jpg
   arr11.jpg
c:\2010-09-06  <==== folder
   arr9.jpg
   arr10.jpg
   arr11.jpg
c:\2010-09-05   <==== folder
   arr2.jpg
   arr3.jpg
   arr4.jpg
   arr5.jpg
   arr6.jpg
   arr7.jpg
   arr8.jpg
c:\2010-09-04  <==== folder
   arr2.jpg
   arr3.jpg
   arr5.jpg
   arr6.jpg
   arr7.jpg
   arr8.jpg
   arr9.jpg
   arr10.jpg
   arr11.jpg
c:\2010-09-03  <==== folder
  arr2.jpg
  arr3.jpg
  arr4.jpg
  arr5.jpg
  arr6.jpg
  arr7.jpg
  arr10.jpg
  arr11.jpg
c:\2010-09-02   <==== folder
 arr2.jpg
 arr3.jpg
 arr4.jpg
 arr5.jpg
 arr6.jpg
 arr7.jpg
 arr8.jpg
 arr11.jpg
c:\2010-09-01  <==== folder
 arr2.jpg
 arr3.jpg
 arr4.jpg

I would like to rename those files as <DATE>_<SrNo>.jpg. and move all the files in single folder called All_pics
The SrNo is a continous running number serial number.

C:\All_pics\
   2010-09-10_54.jpg   
   2010-09-10_55.jpg   
   2010-09-10_56.jpg  
   2010-09-10_57.jpg  
   
   2010-09-09_52.jpg  
   2010-09-09_53.jpg  
   2010-09-08_44.jpg  
   
   2010-09-08_45.jpg  
   2010-09-08_46.jpg  
   2010-09-08_47.jpg  
   2010-09-08_48.jpg  
   2010-09-08_49.jpg  
   2010-09-08_50.jpg  
   2010-09-08_51.jpg  
   
   2010-09-07_39.jpg  
   2010-09-07_40.jpg  
   2010-09-07_41.jpg  
   2010-09-07_42.jpg  
   2010-09-07_43.jpg  
   
   2010-09-06_36.jpg  
   2010-09-06_37.jpg  
   2010-09-06_38.jpg  
   2010-09-05_29.jpg   
   2010-09-05_30.jpg   
   2010-09-05_31.jpg   
   2010-09-05_32.jpg   
   2010-09-05_33.jpg   
   2010-09-05_34.jpg   
   2010-09-05_35.jpg   
   
   2010-09-04_20.jpg   
   2010-09-04_21.jpg   
   2010-09-04_22.jpg   
   2010-09-04_23.jpg   
   2010-09-04_24.jpg   
   2010-09-04_25.jpg   
   2010-09-04_26.jpg   
   2010-09-04_27.jpg   
   2010-09-04_28.jpg   
   
   2010-09-03_12.jpg   
   2010-09-03_13.jpg   
   2010-09-03_14.jpg   
   2010-09-03_15.jpg   
   2010-09-03_16.jpg   
   2010-09-03_17.jpg   
   2010-09-03_18.jpg   
   2010-09-03_19.jpg   
   
   2010-09-02_04.jpg   
   2010-09-02_05.jpg   
   2010-09-02_06.jpg   
   2010-09-02_07.jpg   
   2010-09-02_08.jpg   
   2010-09-02_09.jpg   
   2010-09-02_10.jpg   
   2010-09-02_11.jpg   
   
   2010-09-01_01.jpg  
   2010-09-01_02.jpg 
   2010-09-01_03.jpg 
 

Cygwin? CMD scripting? LINUX dual boot?

This does all but the - to _ change (necessary?), and with a little work, can pick up the date components separately:

find 20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] -name '*.jpg' -type f | sed '
 s/^\(.*\)\/[a-z]*\([0-9]*.jpg)/mv & All_pics\/\1_\2/
 ' | ksh

Sorry I wasn't clear earlier, how can it be done in DOS ?

Thanks

You can make a listing and use MS Word to convert it to the right DOS script? sed works in DOS, too. You could install Cygwin on C:\cygwin and use it.

I did not expect the URL: The UNIX and Linux Forums - Learn UNIX and Linux from Experts.unix.com/windows-dos-issues-discussions/ My dos/CMD is a bit rusty.

http://rubyforge.org/frs/download.php/72075/rubyinstaller-1.9.1-p430.exe

c=1
Dir["2010-*"].sort.each do |x|
  Dir["#{x}/*.jpg"].each do |w|
    pa,f=File.split(w)
    newname=File.join(pa,"#{pa}_#{c}.jpg")
    File.rename(w, newname)
    c+=1
  end
end
C:\path> ruby myscript.rb

Are you happy working at the "cmd" prompt with Batch files?

All the variable names you need are available within modern versions of Batch. You don't mention the version of Windows.

At the "cmd" prompt, see the help text and examples:

for /?