今の私にはコーディングする能力がないので

ls [処理対象ディレクトリ] > ls_command.txt
grep ls_command.txt xls > grep_command_xls.txt
grep ls_command.txt csv > grep_command_csv.txt
grep ls_command.txt txt > grep_command_txt.txt


if( file_size(grep_command_xls.txt) > 0 )
 proc_xlsfile_read() 'xlsファイルとして読み込み処理を行う
 proc_xlsfile_error() '読み込みエラーのデータに対する処理
 proc_xlsfile_to_array() '読み込み結果を当PGM用の配列に置き換える
elseif( file_size(grep_command_csv.txt) > 0 )
 proc_csvfile_read()
 proc_csvfile_error()
 proc_csvfile_to_array()
elseif( file_size(grep_command_txt.txt) > 0 )
 略
else
 拡張子なしのファイルとしての処理
  乱暴ですが、○○.xls、〇〇.csv、○○.txtとしてcopyした
  作成し、proc_〇〇file_read/errorを総当たりで試すしかないのでは?
endif