To get the filename, I would use an extra paramter, the original path. Than you can loop over all the files in the original directory, to get the filenames. If you have the filenames, you can either one of the links mentioned in the comments...
This would be your final solution (UNTESTED):
public static void CopyImagesFromResourceToStorage(Context c,int[] resources,String path, String originalpath)
{
// Get the directory of your original files
File dir = new File(originalpath);
// List all files in that directory
File[] files = dir.listFiles();
// Loop through all the files in your original directory
for(File original: files)
{
// Create a filename: <target_directory> + original.getName();
String filename = path + "\\" + original.getName();
Bitmap bm = BitmapFactory.decodeResource(c.getResources(), resources[i]);
try {
FileOutputStream out = new FileOutputStream(filename);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Be sure to also close the FileOutputStream, and do some extra checks to see the the File[] files is actually holding files and not directories.
NOTE: If you really work with the resouces folder, you can use something like this as well:
Field[] drawables = android.R.drawable.class.getFields();
for (Field f : drawables) {
try {
System.out.println("R.drawable." + f.getName());
} catch (Exception e) {
e.printStackTrace();
}
}
To loop over the resources