Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
media_import_pattern.patch | 1.18 KB | jonathan_hunt | |
Comments
Comment #1
jonathan_hunt CreditAttribution: jonathan_hunt commentedNeeds review.
Comment #2
jonathan_hunt CreditAttribution: jonathan_hunt commentedI meant to say that the current advice of *.jpg|*.gif. didn't work for me whereas *.{jpg|gif} did.
Comment #3
sylus CreditAttribution: sylus commentedIs it possible to do a recursive search on multiple directories, can't seem to get this working with glob.
Comment #4
willvincent CreditAttribution: willvincent commented@sylus: I've just created an issue, and supplied a patch to allow recursion into subdirectories: #1902586: Support recursion into subdirectories for file import
Comment #5
willvincent CreditAttribution: willvincent commentedNeither *.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.
Comment #6
willvincent CreditAttribution: willvincent commentedComment #7
Dave ReidJust 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.
Comment #8
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing 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