【问题标题】:Copy file to new location将文件复制到新位置
【发布时间】:2018-12-29 17:57:26
【问题描述】:

我正在尝试将数据复制到文件夹中的新文件中。
我试过这样做,但没有用:

copyFile(`./data/guilddata/guilds/default/GUILDID.json`, `./data/guilddata/guilds/${guild.id}/GUILDID.json`, (err) => {
    if (err) throw err;
});

https://www.npmjs.com/package/fs-copy-file

有人知道该怎么做吗? (${guild.id} 仅表示公会 ID,该文件夹已经存在)。我也没有错误。谢谢

【问题讨论】:

    标签: javascript bots discord fs discord.js


    【解决方案1】:
    const fs = require('fs');
    
    fs.copyFile('./data/guilddata/guilds/default/GUILDID.json', './data/guilddata/guilds/' + guild.id + '/GUILDID.json', (err) => {
      if (err) throw err;
      console.log('All done! The file is copied!');
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-19
      • 1970-01-01
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 2017-10-11
      • 1970-01-01
      相关资源
      最近更新 更多