title: Rename written CSV file Spark throws Error "Path must be absolute" - Azure Data Lake
body: <p>I tried solution described in <a href="https://stackoverflow.com/questions/44760244/rename-written-csv-file-spark">Rename written CSV file Spark</a> but I am getting the following error "java.lang.IllegalArgumentException: Path must be absolute". How could I fix it? It can be in scala or Python code. Thanks :)</p>
  
  <pre><code>import org.apache.hadoop.fs._
  val fs = FileSystem.get(sc.hadoopConfiguration)
  
  var table_name = dbutils.widgets.get("table_name")
  
  val filePath = "mnt/datalake/" + table_name + "/"
  
  print("file path: " + filePath)
  
  val fileName = fs.globStatus(new Path(filePath+"part*"))(0).getPath.getName
  print("file name: " + fileName)
  
  fs.rename(new Path(filePath+fileName), new Path(filePath+"file.csv"))
  
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>file path: mnt/datalake/MyTable/
  file name: part-00000-tid-9118XXX-c000.csv
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>java.lang.IllegalArgumentException: Path must be absolute: mnt/datalake/MyTable/part-00000-tid-9118XXXXc000.csv
  </code></pre>