<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'Patch between different directories'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 21 Apr 2026 14:07:43 +0000</lastBuildDate>
    <item>
      <title>koncept said on 15/Jun/2008</title>
      <link>https://snipplr.com/view/6667/patch-between-different-directories</link>
      <description>&lt;p&gt;&lt;p&gt;Here's my take on your code. This will protect directory names with spaces as well as optimize the performance a bit:&lt;/p&gt;

&lt;pre class="bash"&gt;#!/usr/bin/env bash
IFS="
"
START=${1:-.} # pass starting directory as arg or assume current directory
d=($(find . -type d ! -name '.*' -maxdepth 1 -print))
for ((i=0,j=1,k=${#d[@]}-1;i "${d[$j]}_changes.patch"
done
# Overview: 
# If (a b c d) dirs were found:
#   compare a to b &gt; b_changes.patch
#   compare b to c &gt; c_changes.patch
#   compare c to d &gt; d_changes.patch
# * This script will protect directories with spaces in their names
&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 15 Jun 2008 12:04:29 UTC</pubDate>
      <guid>https://snipplr.com/view/6667/patch-between-different-directories</guid>
    </item>
    <item>
      <title>koncept said on 15/Jun/2008</title>
      <link>https://snipplr.com/view/6667/patch-between-different-directories</link>
      <description>&lt;p&gt;&lt;p&gt;Sorry.. Had to escape some characters. Here it is again.&lt;/p&gt;

&lt;pre class="bash"&gt;#!/usr/bin/env bash
IFS="
"
START=${1:-.} # pass starting directory as arg or assume current directory
d=($(find . -type d ! -name '.*' -maxdepth 1 -print))
for ((i=0,j=1,k=${#d[@]}-1;i&lt;$k;i++,j++)); do
    echo diff -ru "${d[$i]}" "${d[$j]}" &gt; "${d[$j]}_changes.patch"
done
# Overview: 
# If (a b c d) dirs were found:
#   compare a to b &gt; b_changes.patch
#   compare b to c &gt; c_changes.patch
#   compare c to d &gt; d_changes.patch
# * This script will protect directories with spaces in their names&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 15 Jun 2008 12:09:01 UTC</pubDate>
      <guid>https://snipplr.com/view/6667/patch-between-different-directories</guid>
    </item>
  </channel>
</rss>
