diff --git a/copy b/copy index f93be78..cc42fe1 100755 --- a/copy +++ b/copy @@ -16,6 +16,8 @@ const { argv } = require('yargs') .describe('s', '不填默认拷贝全部文件,如果设置了这个值,则过滤掉小于这个size的文件,必须以b结尾,比如10mb') .alias('S', 'service_account') .describe('S', '指定使用service account进行操作,前提是必须在 ./sa 目录下放置json授权文件,请确保sa帐号拥有操作权限。') + .alias('D', 'dncnr') + .describe('D', 'do not create new root, 不在目的地创建同名文件夹,直接将源文件夹中的文件原样复制到目的文件夹中') .help('h') .alias('h', 'help') @@ -25,11 +27,11 @@ const { DEFAULT_TARGET } = require('./config') let [source, target] = argv._ if (validate_fid(source)) { - const { name, update, file, not_teamdrive, size, service_account } = argv + const { name, update, file, not_teamdrive, size, service_account, dncnr } = argv if (file) { target = target || DEFAULT_TARGET if (!validate_fid(target)) throw new Error('target id 格式不正确') - return copy_file(source, target).then(r => { + return copy_file(source, target, service_account).then(r => { const link = 'https://drive.google.com/drive/folders/' + target console.log('任务完成,文件所在位置:\n', link) }).catch(console.error) @@ -39,7 +41,7 @@ if (validate_fid(source)) { console.log(`不复制大小低于 ${size} 的文件`) min_size = bytes.parse(size) } - copy({ source, target, name, min_size, update, not_teamdrive, service_account }).then(folder => { + copy({ source, target, name, min_size, update, not_teamdrive, service_account, dncnr }).then(folder => { if (!folder) return const link = 'https://drive.google.com/drive/folders/' + folder.id console.log('\n任务完成,新文件夹链接:\n', link)