title: convert a file path into string
body: <p>I'm having an error trying to find a way to replace a string in a directory path with another string</p>
  
  <pre><code>sed: Error tryning to read from {directory_path}: It's a directory 
  </code></pre>
  
  <p>The shell script</p>
  
  <pre><code>#!/bin/sh
  
  R2K_SOURCE="source/"
  R2K_PROCESSED="processed/"
  R2K_TEMP_DIR=""
  
  echo " Procesando archivos desde $R2K_SOURCE "
  
  for file in $(find $R2K_SOURCE )
  do
          if [ -d $file ]
          then
                  R2K_TEMP_DIR=$( sed 's/"$R2K_SOURCE"/"$R2K_PROCESSED"/g' $file )
                  echo "directorio $R2K_TEMP_DIR"
          else
  #               some code executes
                  :
          fi
  done
  
  # find $R2K_PROCCESED -type f -size -200c -delete
  </code></pre>
  
  <p>i'm understanding that the rror it's in this line</p>
  
  <pre><code>R2K_TEMP_DIR=$( sed 's/"$R2K_SOURCE"/"$R2K_PROCESSED"/g' $file )
  </code></pre>
  
  <p>but i don't know how to tell sh that treats $file variable as string and not as a directory object.</p>