function chext --description 'Change extension of files with an extension' -a sourceext -a targetext if test (count $argv) -lt 2 echo 'Missing argument.' return 1 end for file in *.$sourceext echo mv $file (path change-extension $targetext $file) end end