Jump to content

File extension variable: expanding as case independent


Recommended Posts

In a nutshell
1. I have a variable in my workflow configuration called, let’s say, fileType. The relevant popup selection contains various file types listed as file extensions (e.g., RAW DNG: dng, CR2: cr2).
2. I need to extract from a folder a list of all files of the relevant type (i.e.with the relevant file extension) and at the same time change the extension to xmp. However, note that files in the folder might have an upper or lower case extension (e.g., dng or DNG).
3. I create the list of files using the following shell script:
 

find "${folderPath}" -maxdepth 1 -name "*.""${fileType}" | sed -e 's/'"${fileType}"'/xmp/g'> "${tempFile}"


The problem
If the variable value for the relevant extension is lower case the result is a list of the files only with the lower case file extension (and, of course, similarly for an upper case file extension).

How in this case can I use a variable to return a list of files whether the relevant file extension is upper or lower case?

I suspect the answer may involve using a command other than find but my head has been battered against a brick wall for so long on this problem I probably can’t think clearly any more.

Stephen

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...