How can I convert a file path to an URI in the command-line?
/home/MHC/directory with spaces and ümläuts
One way to do this is using
will convert the path to an URI. The "file://" part of the URI will be left out, but you can easily add that via a bash one-liner:
Many thanks to Michael Kjörling for the references!
You can also use the Perl module URI::file directly from the command line: