Исключение File not found при попытке скопировать файл, когда и исходный, и целевой файлы включают / mnt в блоки данных - PullRequest
0 голосов
/ 16 июня 2020
In the below code I am trying to backup my file, It worked when I tried with files in my local computer, but when accessing in

блоки данных с sr c file / mnt, его показывающий файл не найден.

Я даже пытался с "/dbfs/mnt/folder1/x.parquet" не помог. Любая помощь будет оценена

import java.nio.file.{Files, Paths, StandardCopyOption}
object FileBackup {
  def main(args: Array[String]): Unit = {   
      val src_file = ("/mnt/folder1/x.parquet")
      val tgt_file = ("/mnt/folder2/x_1.paraquet")
      val FileList=new java.io.File(tgt_file).exists
      if(!FileList)
      {
      copyRenameFile(src_file,tgt_file)
      println("File Copied Successfully: " + tgt_file)
     }
     else { println("File already Exists, It can be copied only once") }
  }
}
   def copyRenameFile(source: String, destination: String): Unit = {   
   val path = Files.copy(
      Paths.get(source),
      Paths.get(destination),
      StandardCopyOption.REPLACE_EXISTING  
  )
}
FileBackup.main(Array())
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...