5

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?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
muru
  • 69,900
  • 13
  • 192
  • 292
  • @don_crissti yes, that works (piping through `awk -v RS='//' '{printf "%s%s\0", (NR > 1) ? "/" : "", $0 }'` to get nuls instead of double slashes). Post an answer, and I'll add missing bits, if any. – muru Jul 05 '15 at 08:26

1 Answers1

2

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...

don_crissti
  • 79,330
  • 30
  • 216
  • 245