title: moving and renaming a folder in linux
body: <p>I want to ask a question about moving and renaming folders in linux simultaneously.</p>
  <p>Consider I am on my desktop and want to move a folder to another location.</p>
  <p><code>folder1</code> exists at <code>~/folder1</code></p>
  <p>If I want to move it to the desktop, I do the following command:</p>
  <pre><code>mv ~/folder1 ~/Desktop
  </code></pre>
  <p>However, if I want to move <em>and</em> rename the folder, for some reason this is the command:</p>
  <pre><code>mv ~/folder1 ~/Desktop/folder2
  </code></pre>
  <p>I'm confused here slightly.</p>
  <p>If <code>folder2</code> does not exist, <code>folder1</code> is renamed as <code>folder2</code>, keeping all the contents.</p>
  <p>However, if <code>folder2</code> does exist, it simply slots <code>folder1</code> into <code>folder2</code> i.e.</p>
  <pre><code>~/Desktop/folder2/folder1
  </code></pre>
  <p>I thought that if <code>folder2</code> does not exist, it simply creates <code>folder2</code> and inserts <code>folder1</code> into it as per the moving of a file with <code>mv</code>.</p>
  <p>Why does the folder simply get renamed from <code>folder2</code> to <code>folder1</code>?</p>