I have a directory structure like this:
|--Photos  
   |--2014-01-15 #2  
      |--IMG_0045.JPG  
      |--IMG_0051.JPG  
   |--2014-06-19  
      |--IMG_0078.JPG  
Notice one folder's name contains a space [ 2014-01-15 #2 ]. I wrote a bash script to move only the *.JPG files in all the folders using this:
#!/bin/bash
for i in $(ls); do  
    if [ -d $i ]; then
        cd $i
        mv *.JPG /opt/data/tmp/
        cd -
    fi
done  
I understand that the script didn't go into the folders with names that contained spaces because of word splitting.
Is there a bash script you could write in order to move *.JPG files from all folders?
 
    