<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Fdupes on KnightLi Blog</title>
        <link>https://www.knightli.com/en/tags/fdupes/</link>
        <description>Recent content in Fdupes on KnightLi Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Wed, 06 May 2026 09:23:09 +0800</lastBuildDate><atom:link href="https://www.knightli.com/en/tags/fdupes/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>How to Control fdupes Deletion Order: Keep Duplicate Files by Directory Priority</title>
        <link>https://www.knightli.com/en/2026/05/06/fdupes-delete-duplicates-by-directory-priority/</link>
        <pubDate>Wed, 06 May 2026 09:23:09 +0800</pubDate>
        
        <guid>https://www.knightli.com/en/2026/05/06/fdupes-delete-duplicates-by-directory-priority/</guid>
        <description>&lt;p&gt;When using &lt;code&gt;fdupes&lt;/code&gt; to delete duplicate files across three directories, such as &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, and &lt;code&gt;c&lt;/code&gt;, and you want to keep &lt;code&gt;a&lt;/code&gt; first, then &lt;code&gt;b&lt;/code&gt;, and delete duplicates from &lt;code&gt;c&lt;/code&gt; first, the key is not a complex rule. It is the order of directory arguments.&lt;/p&gt;
&lt;p&gt;In non-interactive delete mode, &lt;code&gt;fdupes&lt;/code&gt; keeps the first file it sees in each duplicate group and deletes later duplicates. Therefore, directory arguments should be arranged from highest retention priority to lowest.&lt;/p&gt;
&lt;p&gt;In other words, to achieve &amp;ldquo;delete from c first, then b, and keep a as much as possible&amp;rdquo;, write the command like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN a b c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The scan order is &lt;code&gt;a -&amp;gt; b -&amp;gt; c&lt;/code&gt;. When the same file exists in all three directories, the file in &lt;code&gt;a&lt;/code&gt; is found first and kept, while duplicates in &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt; are deleted. If only &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt; contain duplicates, &lt;code&gt;b&lt;/code&gt; is kept and &lt;code&gt;c&lt;/code&gt; is deleted.&lt;/p&gt;
&lt;h2 id=&#34;parameter-meaning&#34;&gt;Parameter Meaning
&lt;/h2&gt;&lt;p&gt;Common parameters are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-r&lt;/code&gt;: recursively scan subdirectories.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-d&lt;/code&gt;: delete duplicate files.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-N&lt;/code&gt;: when used with &lt;code&gt;-d&lt;/code&gt;, skip interactive confirmation, keep the first file in each duplicate group, and delete the rest.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore, the basic format for automatic duplicate deletion is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN 目录A 目录B 目录C
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The earlier a directory appears, the higher its retention priority. The later it appears, the more likely its duplicate files are to be deleted.&lt;/p&gt;
&lt;h2 id=&#34;preview-before-deleting&#34;&gt;Preview Before Deleting
&lt;/h2&gt;&lt;p&gt;Using &lt;code&gt;-dN&lt;/code&gt; deletes files directly, so it is better to preview duplicate groups first:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -r a b c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The output is grouped by duplicate files. In each group, the file shown earlier is the one more likely to be kept in non-interactive deletion mode.&lt;/p&gt;
&lt;p&gt;You can also view summary information:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rm a b c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If the data is important, save the result and inspect it manually:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -r a b c &amp;gt; duplicates.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;After confirming that the order within each duplicate group matches your expectations, run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN a b c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;how-subdirectories-are-handled&#34;&gt;How Subdirectories Are Handled
&lt;/h2&gt;&lt;p&gt;As long as &lt;code&gt;-r&lt;/code&gt; is enabled, &lt;code&gt;fdupes&lt;/code&gt; recursively scans all files under the directories you pass in. Retention priority is still determined by the order in which paths appear in the command.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN dir_a dir_b dir_c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This means:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dir_a&lt;/code&gt; has the highest priority.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dir_b&lt;/code&gt; comes next.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dir_c&lt;/code&gt; has the lowest priority.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If &lt;code&gt;dir_a/sub1/file.txt&lt;/code&gt; and &lt;code&gt;dir_c/sub1/file.txt&lt;/code&gt; have identical content, the file under &lt;code&gt;dir_a&lt;/code&gt; is kept. If &lt;code&gt;dir_a/x/y/file.txt&lt;/code&gt; and &lt;code&gt;dir_c/file.txt&lt;/code&gt; have identical content, the file under &lt;code&gt;dir_a&lt;/code&gt; is still kept first. &lt;code&gt;fdupes&lt;/code&gt; compares file content; filenames and directory depth do not need to match.&lt;/p&gt;
&lt;h2 id=&#34;precisely-controlling-subdirectory-priority&#34;&gt;Precisely Controlling Subdirectory Priority
&lt;/h2&gt;&lt;p&gt;If you only pass parent directories, the scan order inside subdirectories is determined by &lt;code&gt;fdupes&lt;/code&gt; traversal behavior. This is enough in most cases. But if you want a specific subdirectory to have higher priority, write it explicitly before its parent directory.&lt;/p&gt;
&lt;p&gt;For example, suppose you want to keep &lt;code&gt;dir_a&lt;/code&gt; first, then keep &lt;code&gt;dir_b/special&lt;/code&gt;, then process the rest of &lt;code&gt;dir_b&lt;/code&gt;, and finally process &lt;code&gt;dir_c&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN dir_a dir_b/special dir_b dir_c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;This makes &lt;code&gt;dir_b/special&lt;/code&gt; scan before &lt;code&gt;dir_b&lt;/code&gt;. When &lt;code&gt;dir_b&lt;/code&gt; is scanned later, files under &lt;code&gt;special&lt;/code&gt; have already been recorded, so that subdirectory effectively has higher priority than the rest of &lt;code&gt;dir_b&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This pattern is useful when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a&lt;/code&gt; is the most important baseline directory.&lt;/li&gt;
&lt;li&gt;A subdirectory inside &lt;code&gt;b&lt;/code&gt; is more important than the rest of &lt;code&gt;b&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;c&lt;/code&gt; is mainly a low-priority backup directory.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The path order can be extended further:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN a b/important b c/keep-first c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The rule is still the same: the earlier it appears, the more likely it is to be kept.&lt;/p&gt;
&lt;h2 id=&#34;use-a-list-for-many-directories&#34;&gt;Use a List for Many Directories
&lt;/h2&gt;&lt;p&gt;If there are many directories and subdirectories, manually writing a long command is error-prone. You can write paths into a text file such as &lt;code&gt;folders.txt&lt;/code&gt;, ordered by priority:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/path/to/dir_a
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/path/to/dir_b/sub_important
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/path/to/dir_b
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/path/to/dir_c/sub_1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/path/to/dir_c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Then pass them to &lt;code&gt;fdupes&lt;/code&gt; with &lt;code&gt;xargs&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cat folders.txt &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; xargs fdupes -rdN
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If paths may contain spaces, use null-separated input for better safety:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tr &lt;span class=&#34;s1&#34;&gt;&amp;#39;\n&amp;#39;&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;\0&amp;#39;&lt;/span&gt; &amp;lt; folders.txt &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; xargs -0 fdupes -rdN
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;important-boundaries&#34;&gt;Important Boundaries
&lt;/h2&gt;&lt;p&gt;First, &lt;code&gt;fdupes&lt;/code&gt; compares file content, not filenames. Two files with completely different names can still be treated as duplicates if their content is identical.&lt;/p&gt;
&lt;p&gt;Second, if directory &lt;code&gt;a&lt;/code&gt; contains duplicates internally, &lt;code&gt;fdupes -rdN a b c&lt;/code&gt; may also delete later duplicates inside &lt;code&gt;a&lt;/code&gt;. This command means &amp;ldquo;keep the first file according to the overall scan order&amp;rdquo;, not &amp;ldquo;never delete anything under a&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Third, by default, &lt;code&gt;fdupes&lt;/code&gt; does not follow symbolic links. If you need to handle files behind symlinks, confirm whether &lt;code&gt;-s&lt;/code&gt; is needed and whether that matches your data-safety expectations.&lt;/p&gt;
&lt;p&gt;Fourth, &lt;code&gt;fdupes&lt;/code&gt; only deletes duplicate files. It does not clean up empty directories. After deletion, if &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt; contain empty folders, you can run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;find b c -type d -empty -delete
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;safer-operating-habit&#34;&gt;Safer Operating Habit
&lt;/h2&gt;&lt;p&gt;If the directories contain important data, do not start with &lt;code&gt;-rdN&lt;/code&gt;. A safer workflow is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;fdupes -r a b c&lt;/code&gt; first to view duplicate groups.&lt;/li&gt;
&lt;li&gt;Confirm that the first file in each group is the one you want to keep.&lt;/li&gt;
&lt;li&gt;Then run &lt;code&gt;fdupes -rdN a b c&lt;/code&gt; for automatic deletion.&lt;/li&gt;
&lt;li&gt;After deletion, check whether empty directories need cleanup.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you are very worried about accidentally deleting files under &lt;code&gt;a&lt;/code&gt;, first clean a smaller range of low-priority directories, or export the results and filter them manually. The directory order in &lt;code&gt;fdupes&lt;/code&gt; is useful, but it is not an access-control rule. Once a path is included in the scan, duplicate files inside it may participate in deletion decisions.&lt;/p&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary
&lt;/h2&gt;&lt;p&gt;To delete duplicate files with &lt;code&gt;fdupes&lt;/code&gt; by priority, put the directories you want to keep earlier and the directories you want to delete from later.&lt;/p&gt;
&lt;p&gt;To keep &lt;code&gt;a&lt;/code&gt;, then &lt;code&gt;b&lt;/code&gt;, and delete from &lt;code&gt;c&lt;/code&gt; first:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN a b c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;To give a subdirectory higher priority, write it before its parent directory:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;fdupes -rdN a b/important b c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The key sentence is simple: &lt;code&gt;fdupes -dN&lt;/code&gt; keeps duplicate files that appear first and deletes duplicates that appear later. Directory order is your retention priority.&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
