I have a flow that occasionally accepts files with quotation marks in the name. This (obviously) wreaks havoc on scripts and everything else. I thought a good solution would be to use the Rename element to change the quotes to some other string, then revert the name at the end of the flow. The first part works, but when it renames the file back, instead of a quotation mark, it replaces it with an underscore.
I've tried using the "Remember original name" in the first Rename, and replacing the Name Proper with the stored private key, this yielded an underscore.
I tried replacing using a regular expression (", \", and \\") and the replacement doesn't happen.
Any thoughts how I can get the quotation mark back into the filename? I don't have control over the input of the files. Users may submit a file named 5" x 7" print.tif.
Handling files with quotes
Re: Handling files with quotes
When you first rename the job without quotes, have you tried the property "Remember original name"? It will keep the job name as Private data and then you just rename back to that property value.
Re: Handling files with quotes
I have run into this problem before, and I don't think there is any way you can get Switch to rename af ile using a name that includes quotes.
Jan, what you suggest is exactly what ericnd01 is describing, that he already tried
Jan, what you suggest is exactly what ericnd01 is describing, that he already tried
Re: Handling files with quotes
Yeah, "Remember original name" does not work. I've tested using explicit names and storing as my own private key and it seems anytime the Rename element is used, it replaces the " with _. I'm going to see if a Script will work any better. I'll let you know what I find out.
Re: Handling files with quotes
I was able to resolve this using a script:
I use an earlier Rename flow element to change the " to == in the job name. I don't know how well this will work on multi-file jobs (or other caveats), but the application I am using it in seems to work fine. I actually took it further by adding element properties for further customization, but figured I'd keep it simple here.
Code: Select all
function jobArrived( s : Switch, job : Job ) {
newFile = job.getName().replace("==", "\"" );
job.sendToSingle(job.getPath(), newFile);
}