Stephen_C Posted July 26, 2024 Posted July 26, 2024 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
FireFingers21 Posted July 26, 2024 Posted July 26, 2024 @Stephen_C You're so close! Changing the -name flag of the find command to -iname makes the match case insensitive, so this command should work for you: Quote find "${folderPath}" -maxdepth 1 -iname "*.${fileType}" Stephen_C 1
Stephen_C Posted July 26, 2024 Author Posted July 26, 2024 Thanks very much for the response. It was most helpful (as you always are) and set me on the right track. Stephen FireFingers21 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now