<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>dired on Alán's blog</title><link>https://quasimorphic.com/tags/dired/</link><description>Recent content in dired on Alán's blog</description><generator>Hugo</generator><language>en-uk</language><lastBuildDate>Thu, 23 Oct 2025 15:21:00 -0400</lastBuildDate><atom:link href="https://quasimorphic.com/tags/dired/index.xml" rel="self" type="application/rss+xml"/><item><title>Use dired-do-shell to explore the parquet schema from Emacs</title><link>https://quasimorphic.com/archive/emacs_dired_do_shell_duckdb/</link><pubDate>Thu, 23 Oct 2025 15:21:00 -0400</pubDate><guid>https://quasimorphic.com/archive/emacs_dired_do_shell_duckdb/</guid><description>&lt;p>I use &lt;code>dired-do-shell&lt;/code> command in Emacs to run CLI commands from within its file manager &lt;a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html">dired&lt;/a>. This workflow makes it easy to perform batch operations on files that would be annoying otherwise. The trouble arose when trying to use the &lt;code>duckdb&lt;/code> CLI to print the schema of a parquet file, as the notation for wildcards in emacs (&lt;code>*&lt;/code> and &lt;code>?&lt;/code>) conflicts with duckdb&amp;rsquo;s usage of the former. Thus running the following after &lt;code>M-x dired-do-shell&lt;/code> (bound to &lt;code>!&lt;/code> in &lt;code>dired-mode&lt;/code>) did not work:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>duckdb -c &lt;span style="color:#e6db74">&amp;#34;DESCRIBE * FROM read_parquet(&amp;#39;?&amp;#39;)&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>I am trying to get Emacs to substitute &lt;code>?&lt;/code> for the selected file(s) in dired and retain &lt;code>*&lt;/code> as a normal duckdb wildcard (for which it means &amp;ldquo;get all columns&amp;rdquo;), but Emacs interprets the star as a wildcard and not the question mark. Thus Emacs yapped about it:&lt;/p>
&lt;blockquote>
&lt;p>dired-do-shell-command: You can not combine ‘*’ and ‘?’ substitution marks&lt;/p>&lt;/blockquote>
&lt;p>The trick is that we need to surround &lt;code>?&lt;/code> with backquotes (&lt;code>`&lt;/code>), otherwise the spaces will be in the file name that &lt;code>read_parquet&lt;/code> ingests. To fix the &amp;ldquo;naked star&amp;rdquo; problem (which Emacs will try to substitute) we can envelop it with the &lt;code>COLUMNS()&lt;/code> command, and the lack of spaces around &lt;code>*&lt;/code> will prevent Emacs from substituting its value. Thus the following command in the Emacs command line does the trick:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>duckdb -c &lt;span style="color:#e6db74">&amp;#34;DESCRIBE COLUMNS(*) FROM read_parquet(&amp;#39;`?`&amp;#39;)&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Which is a bit verbose but I can easily reuse from my command history to explore the schemas or parquets without leaving the dired buffer.&lt;/p></description></item>/</channel></rss>