Skip to content

Cookbook: Removing .Thumbs.db and other operating system files from ingest packages generated with MIK

Mark Jordan edited this page Jan 25, 2017 · 3 revisions

MIK comes with a script (extras/scripts/remove_files.php) that can be run on a directory to delete all files with specific names. You might want to do this because some operating systems create files that may creep into ingest packages during file copy operations or other common tasks. Two examples are '.Thumbs.db' on Windows and '.DS_Store' on OS X.

To remove these two files from a directory containing a batch of Islandora ingest packages, run the remove_files.php script on the directory immediately prior to ingesting the packages:

php remove_files.php -d=/target/directory -l=/path/to/log/file

The -d option is required since it identifies the directory to scan. The -l (for 'log') option is not required. If you include it, a message for each file the script deletes, or attempts to delete but can't due to permissions problems, is written to the specified file; if you don't include it, messages are printed to STDOUT.

If you know the names of other files you want the script to delete, add them to the $files_to_remove array near the top of the script.

If you're on Windows and prefer to use a PowerShell or cmd command to remove .Thumbs.db files, see this cookbook entry.

Cookbook table of contents

Clone this wiki locally