我在S3中存储了大约一百万个文本文件。我想根据文件夹名称重命名所有文件。
我如何在Spark-Scala中做到这一点?
我正在寻找一些示例代码。
我正在使用齐柏林飞艇来运行我的spark脚本。
下面的代码我已经尝试从答案中建议
import org.apache.hadoop.fs._
val src = new Path("s3://trfsmallfffile/FinancialLineItem/MAIN")
val dest = new Path("s3://trfsmallfffile/FinancialLineItem/MAIN/dest")
val conf = sc.hadoopConfiguration // assuming sc = spark context
val fs = Path.getFileSystem(conf)
fs.rename(src, dest)
Run Code Online (Sandbox Code Playgroud)
但是低于错误
<console>:110: error: value getFileSystem is not a member of object org.apache.hadoop.fs.Path
val fs = Path.getFileSystem(conf)
Run Code Online (Sandbox Code Playgroud) scala amazon-s3 amazon-web-services apache-spark apache-zeppelin