title: Linux CP using AWK output
body: <p>I have been trying to learn more about Linux and have spent this morning focusing on the awk command. the command I have been trying to get to work is below.</p>
  
  <pre><code>ls -lRt lpftp.* | awk '{print $7, $9}' | mkdir -p $(awk '{print $1}') | ls -lRt lpftp.* | cp $(awk '{print $9, $7}')
  </code></pre>
  
  <p>Essentially I am trying to move each file in a directory into a sub directory based on that files last modified day. The command first prints only the files I want, then uses mkdir to create a folder based on the day of the month it was last modified. What I want to do after that is move each file into its associated directory, however as the command is now it moves every file into the 01 folder and prints out the following text </p>
  
  <pre><code>cp: 0653-436  12 is a directory.
      Specify -r or -R to copy.
  </code></pre>
  
  <p>once for every directory.</p>
  
  <p>does anyone know how I can fix this issue? or if there is a better way to go about it?</p>