title: How to deal with multiple dots in a file name with Python pathlib?
body: <p>I am having an issue with pathlib when I try to construct a file path that has a &quot;.&quot; in its name, the pathlib module ignores it.</p>
  <p>Here are example lines (I tried multiple versions, all resulted the same issue)</p>
  <p>The issue is that the original file name will be coming from another application, so it is not like I can edit the name myself. I also do not want to do string replacement work arounds, if possible.</p>
  <p>path=r&quot;c:\temp&quot;</p>
  <h1>1</h1>
  <p><code>p=Path(path).joinpath(&quot;myfile.001&quot;).with_suffix(&quot;.bat&quot;)</code></p>
  <h1>2</h1>
  <p><code>p=Path(path, &quot;myfile.001&quot;).with_suffix(&quot;.bat&quot;)</code></p>
  <h1>3</h1>
  <p><code>p=Path(path).with_name(&quot;myfile.001&quot;).with_suffix(&quot;.bat&quot;)</code></p>
  <p>All these lines will yield to</p>
  <p><code>WindowsPath('C:/temp/myfile.bat')</code></p>
  <p>So how do I make pathlib.Path to construct this full path properly. The final path has to be</p>
  <p><code>WindowsPath('C:/temp/myfile.001.bat')</code></p>
  <p>Not</p>
  <p><code>WindowsPath('C:/temp/myfile.bat')</code></p>
  <p>Naturally I am looking for a way to do it through <code>pathlib</code> itself, otherwise I can just use os.</p>
  <p>thanks</p>