How do I safely get multiple filenames from Zenity?

Zenity can be used to create a file selection dialog and select multiple paths. The separator for paths is specified using the --separator option. Therefore we can’t use NUL, the only safe character for delimiting filenames. So, aside from multiple file selection dialogs, is there any way to safely get multiple paths from Zenity? Or using another dialog program?

Asked By: muru

||

You could use another character that cannot appear in a file name: /
so once you got your list of files you know that paths are separated by two slashes: // (the second being part of the path as each path starts with a slash but doesn’t end with one). You could then use your favourite tool to turn the list into NUL separated paths…

Answered By: don_crissti
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.