Batch importing media files into MediaWiki
Importing the binary data
cd /var/www/testwiki; php ./maintenance/importImages.php --conf ./LocalSettings.php --comment="My Comment" --user="MyUser" <<temp_dir>> jpg gif png
If no comment is added a default comment "Importing image file" will be inserted by mediawiki. The default user if none is added is "Maintenance script".
Important: for all batchimporting, revisiondate must be set to something newer than all old revisions; else mediawiki will sort the imported revision behind existing revisions. The id in the imported xml is not necessary, however.
For usernames the name, not the ID counts.
By default, the XML importing version of the web interface limits filesizes to around 1.4 MB. This can be changed by the server admin (or you in php.ini in maxuploadsize=); for larger imports using
Batch renaming files in Linux
Often files should add or drop a prefix. To add a prefix "XXX_"use:
cd ../foto01; for i in *.jpg; do mv -i "$i" "XXX_$i"; done
Should this have been executed twice, or should a prefix be removed, use rename with a perl substitution string (s/fromold/tonew/), like
rename 's/XXX_XXX_/XXX_/' *.jpg
See also: Creating Mediawiki XML imports (i.e. import text for pages)