You can do something like:

 

dbutils.fs.cp("/foo/part-00000","/foo/my-data.csv")

 

Stefan Panayotov, PhD

spanayotov@outlook.com

spanayotov@comcast.net

Cell: 610-517-5586

Home: 610-355-0919

 

From: Gavin Yue [mailto:yue.yuanyuan@gmail.com]
Sent: Thursday, August 25, 2016 1:15 PM
To: user <user@spark.apache.org>
Subject: How to output RDD to one file with specific name?

 

I am trying to output RDD to disk by

 

rdd.coleasce(1).saveAsTextFile("/foo")

 

It outputs to foo folder with a file with name: Part-00000. 

 

Is there a way I could directly save the file as /foo/somename ?

 

Thanks.