With a server running Ubuntu 8.04 the suggested pattern for Media import of "*.{jpg|gif}" doesn't work for me. I found *.{jpg|gif} to work, provided the GLOB_BRACE option is enabled (refer attached patch).

I can't find any reference to | as a pattern separator for glob (see for example, http://cowburn.info/2010/04/30/glob-patterns/

Also, it would be a UI improvement if this form remembered the last input options selected for the user.

CommentFileSizeAuthor
media_import_pattern.patch1.18 KBjonathan_hunt
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan_hunt’s picture

Status: Active » Needs review

Needs review.

jonathan_hunt’s picture

I meant to say that the current advice of *.jpg|*.gif. didn't work for me whereas *.{jpg|gif} did.

sylus’s picture

Is it possible to do a recursive search on multiple directories, can't seem to get this working with glob.

willvincent’s picture

@sylus: I've just created an issue, and supplied a patch to allow recursion into subdirectories: #1902586: Support recursion into subdirectories for file import

willvincent’s picture

Neither *.jpg|*.gif, nor *.{jpg|gif} work for me.

However, *.{jpg,gif} does.

According to the PHP docs for glob(), GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c'

What I'm unclear on is if it then would have to be {*.jpg,*.gif} or if the *. before the curly brace is correct and any comma separated values within it are appended to that *.

In either case, as it's currently implemented in the module it is incorrect, and the patch supplied above is also incorrect.

willvincent’s picture

Status: Needs review » Needs work
Dave Reid’s picture

Just an FYI that I committed some major improvements to the import screen to try and help clear things up a little bit: http://drupalcode.org/project/media.git/commit/d460ba9. We're now using file_scan_directory() and a syntax more similar to existing patterns that people know, like the Block page visibility settings, supporting * as a wildcard and entering one pattern per line.

Not sure if this improvement should be backported to the 1.x branch.

Chris Matthews’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team