C Shell Script: While function not fully looping

I am new to scripting and this is probably the 4th or 5th simple script I have written. I am working with a HUGE number of data that need to be organized into folders and named a certain way. I wrote the naming script using a while function to go through the 1000-some folders and rename the files within. However, when it hits a folder with nothing in it, or without all the file types I have indicated, the script stops and does not name all the files. I have written other scripts with the while function and it works fine, even when files are missing or otherwise, so I'm not sure whats going on. Thanks for any help!

Here is the script:

#!/bin/csh
# start in the parent directory with all the folders
@ h = 1
while ( $h <= 3)

cd $h
@ c = 524
foreach f (*$c*X.sac) 
mv $f QC.$c.__BNX.sac
end
cd ../ 
@ h++
end