<?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>Forem: Phil Lambert</title>
    <description>The latest articles on Forem by Phil Lambert (@philambert54).</description>
    <link>https://forem.com/philambert54</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F182312%2F37744bfc-3c82-4b94-929d-37b7c081def5.jpg</url>
      <title>Forem: Phil Lambert</title>
      <link>https://forem.com/philambert54</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/philambert54"/>
    <language>en</language>
    <item>
      <title>Problem with moving files to subfolders</title>
      <dc:creator>Phil Lambert</dc:creator>
      <pubDate>Tue, 18 Jun 2019 09:01:39 +0000</pubDate>
      <link>https://forem.com/philambert54/problem-with-moving-files-to-subfolders-21n4</link>
      <guid>https://forem.com/philambert54/problem-with-moving-files-to-subfolders-21n4</guid>
      <description>&lt;p&gt;Hey,&lt;br&gt;
I have a problem with the code below. It should automatically move files with the same name (or only a part of it) as the directory into directories and subdirectories.&lt;br&gt;
It works very well for root directories but not for subdirectories. I thought os.walk was going through the whole tree structure. If you see where the bug comes from.... Thank you for your help.&lt;/p&gt;

&lt;p&gt;def moveFiles2Folder():&lt;br&gt;
    root_path = lien vers mon répertoire de départ&lt;br&gt;
    for (root, dirs, files) in os.walk(root_path):&lt;br&gt;
        for dir in dirs :&lt;br&gt;
            for file in files :&lt;br&gt;
                    fileX = os.path.splitext(file)[0]&lt;br&gt;
                    if fileX in dir :&lt;br&gt;
shutil.copy(os.path.join(root_path,file),os.path.join(root_path, dir))&lt;/p&gt;

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