<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>basename &#8211; Wade Tregaskis</title>
	<atom:link href="https://wadetregaskis.com/tags/basename/feed/" rel="self" type="application/rss+xml" />
	<link>https://wadetregaskis.com</link>
	<description></description>
	<lastBuildDate>Sat, 13 Jan 2024 20:57:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wadetregaskis.com/wp-content/uploads/2016/03/Stitch-512x512-1-256x256.png</url>
	<title>basename &#8211; Wade Tregaskis</title>
	<link>https://wadetregaskis.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">226351702</site>	<item>
		<title>Zsh has neat shortcuts for decomposing file names &#038; paths</title>
		<link>https://wadetregaskis.com/zsh-has-neat-shortcuts-for-decomposing-file-names-paths/</link>
					<comments>https://wadetregaskis.com/zsh-has-neat-shortcuts-for-decomposing-file-names-paths/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Fri, 22 Sep 2023 03:54:29 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[basename]]></category>
		<category><![CDATA[dirname]]></category>
		<category><![CDATA[file paths]]></category>
		<category><![CDATA[Zsh]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=5264</guid>

					<description><![CDATA[I only just learned that the venerable basename and dirname are no longer necessary, let-alone the horrible string splitting required for teasing apart names from file extensions. Zsh has some awesomely convenient expansion modifiers which do it all! e.g. given the path &#8220;/Users/me/Documents/Work.zip&#8221;: $file:t → Work.zip $file:h → /Users/me/Documents $file:r → /Users/me/Documents/Work $file:e → zip&#8230; <a class="read-more-link" href="https://wadetregaskis.com/zsh-has-neat-shortcuts-for-decomposing-file-names-paths/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>I only just learned that the venerable <code>basename</code> and <code>dirname</code> are no longer necessary, let-alone the horrible string splitting required for teasing apart names from file extensions.  Zsh has some awesomely convenient expansion modifiers which do it all!  e.g. given the path &#8220;/Users/me/Documents/Work.zip&#8221;:</p>



<pre class="wp-block-preformatted">$file:t → Work.zip

$file:h → /Users/me/Documents

$file:r → /Users/me/Documents/Work

$file:e → zip</pre>



<p>You can also compose these arbitrarily, e.g.:</p>



<pre class="wp-block-preformatted">$file:t:r → Work</pre>



<p>A full list of expansion modifiers is in <a href="https://zsh.sourceforge.io/Doc/Release/Expansion.html#Modifiers" data-wpel-link="external" target="_blank" rel="external noopener">the Zsh Modifiers documentation</a>.</p>



<p>Kudos to <a href="https://zaiste.net/posts/zsh-get-filename-extension-path/" data-type="link" data-id="https://zaiste.net/posts/zsh-get-filename-extension-path/" data-wpel-link="external" target="_blank" rel="external noopener">Zaiste Programming</a> for clueing me into this.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/zsh-has-neat-shortcuts-for-decomposing-file-names-paths/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5264</post-id>	</item>
	</channel>
</rss>
