<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Botong Ou</title>
    <description>The latest articles on DEV Community by Botong Ou (@botong_ou_05ffaa2338a7419).</description>
    <link>https://dev.to/botong_ou_05ffaa2338a7419</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4127780%2Fd4291ad7-2da4-4118-a088-78ae77c4f536.png</url>
      <title>DEV Community: Botong Ou</title>
      <link>https://dev.to/botong_ou_05ffaa2338a7419</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/botong_ou_05ffaa2338a7419"/>
    <language>en</language>
    <item>
      <title>Folder Copy Organizer: a preview-first Python file-copy workflow</title>
      <dc:creator>Botong Ou</dc:creator>
      <pubDate>Wed, 16 Sep 2026 10:04:23 +0000</pubDate>
      <link>https://dev.to/botong_ou_05ffaa2338a7419/folder-copy-organizer-a-preview-first-python-file-copy-workflow-3pca</link>
      <guid>https://dev.to/botong_ou_05ffaa2338a7419/folder-copy-organizer-a-preview-first-python-file-copy-workflow-3pca</guid>
      <description>&lt;p&gt;Disclosure: this article was generated by an AI agent using the project's source and a recorded local test. The software was developed with AI assistance. The account sharing it is associated with the commercial tool. The examples below are fictional test files, not client results.&lt;/p&gt;

&lt;p&gt;Folder Copy Organizer is a small Python 3.10+ command-line project. It copies a folder's top-level files into folders named by extension, while retaining the source files. It has no graphical interface and uses Python's standard library.&lt;/p&gt;

&lt;p&gt;The useful design question was where to put the boundary between inspecting files and changing the filesystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The default command writes nothing
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;python organize.py demo-inbox demo-sorted
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This reports a JSON plan. A separate invocation with &lt;code&gt;--apply&lt;/code&gt; performs the copies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;python organize.py demo-inbox demo-sorted --apply
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a recorded run using the distributed v1 script, the input contained &lt;code&gt;orders.csv&lt;/code&gt;, &lt;code&gt;notes.txt&lt;/code&gt;, &lt;code&gt;README&lt;/code&gt;, and a subfolder named &lt;code&gt;nested&lt;/code&gt;. The output included:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;demo-sorted/
  type-csv/orders.csv
  type-txt/notes.txt
  type-no-standard-extension/README
  copy-manifest.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The preview created no destination. After applying it, all three originals were unchanged, the copied contents matched their recorded hashes, and the subfolder was skipped. Those are observations from that fixture, not a performance or universal reliability claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping the output separate
&lt;/h2&gt;

&lt;p&gt;The destination must be new and outside the source tree. Existing destinations and nested source/destination paths are rejected. Copied files are opened in exclusive creation mode, avoiding a silent overwrite of an existing target.&lt;/p&gt;

&lt;p&gt;Folder names use a &lt;code&gt;type-&lt;/code&gt; prefix instead of using the extension verbatim. The implementation accepts short alphanumeric extensions and groups other cases separately. This also avoids using names such as &lt;code&gt;CON&lt;/code&gt; directly as a Windows directory name.&lt;/p&gt;

&lt;h2&gt;
  
  
  A manifest is an inspection aid
&lt;/h2&gt;

&lt;p&gt;The copy process records completed items and SHA-256 values. A copy failure leaves partial output for inspection; the operation is not transactional and does not roll everything back. Source content is checked around copying, but this is not a security boundary against hostile concurrent filesystem changes.&lt;/p&gt;

&lt;p&gt;Preview and apply are separate runs. The apply command constructs its own current plan; it does not execute a previously saved preview. Keep the source stable between those steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deliberate limits
&lt;/h2&gt;

&lt;p&gt;The current version skips symlinks and subfolders. It does not deduplicate, rename, recurse, preserve original timestamps or ACLs, or integrate with cloud storage. It needs disk space for the copied files and is intended for a small, stable folder that the user controls.&lt;/p&gt;

&lt;p&gt;The main lesson from this implementation is that a copy utility needs clear failure behavior as much as a grouping rule: what will be written, where it can go, and what remains if copying stops.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>python</category>
    </item>
  </channel>
</rss>
