重命名文件附加时间戳并将其移动到 ADLS Gen2 (Databricks) 上的不同文件夹

问题描述

我想将时间戳附加到每个文件名称中,并将其从 databricks notebook 移动到 ADLS Gen2 上的另一个文件夹。 我可以列出如下文件名。

fileList = dbutils.fs.ls(file_input)

for i in fileList:
  try:
    file_path = i.path
    #Rename the file appending timestamp
    parser = datetime.datetime.Now()
    time_stamp = parser.strftime("%Y%m%d-%H%M%s")
    # Rename the files on ADLS Gen2 appennding time_stamp 

    #Move the file
    dbutils.fs.mv(file_path,file_path_archive)
  except Exception as e:
    raise Exception(str(e))

如何为 ADLSGen2 上的文件重命名附加时间戳的文件。谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)