-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(fs): Add skipExisting option to move and copy, merge option to copy #1556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
我测试了下功能没有问题,但是有个小疑问, 在使用勾选仅复制新文件与文件夹时,任务列表中的任务名称变为了 应该同步更新一下任务类型相关? |
这个功能设计上就叫做 |
emm这个倒不是功能名称问题,我的意思是任务名称带了源路径目标路径,这就会导致了一个问题,进去一看是密密麻麻的的重复路径,观感上总感觉没那么好, 你可以考虑一下将任务名称中的路径优化一下,或者看看大佬们的看法 |
这个不是我这次加的,是原有复制任务中就存在的,目的是为了显示任务的信息 |
明白你意思了,我看看 |
已在前端仓库修复此问题 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for SkipExisting and Merge options to file move and copy operations. These options allow users to skip files that already exist at the destination or merge directory contents instead of overwriting.
- Adds
SkipExistingandMergeboolean fields to theMoveCopyReqstruct - Implements a new
mergetask type with logic to skip existing files when merging directories - Updates move and copy handlers to filter out files based on the new flags
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| server/handles/fsmanage.go | Adds new request fields and conditional logic to filter valid file names based on SkipExisting and Merge flags in both FsMove and FsCopy functions |
| internal/fs/fs.go | Adds new Merge function that calls transfer with the merge task type |
| internal/fs/copy_move.go | Implements the merge task type, updates task routing logic, and adds merge-specific behavior to skip existing files during directory merging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
我感觉 而 看下是否调整下显示逻辑较好,或者甚至移除 因为我是觉得这种小众的功能没必要添加到这种常用的显示中, 当然这个小众也可能是我的偏见 |
其实是因为最开始我复制文件,发现重复的得一个个勾选,就先加了个skip的功能。然后用着用着发现当前复制满足不了子文件夹的更新,所以才继续加的merge。 本质来说merge其实能够替代掉skip,因为它也会跳过存在的文件。但是一个差别就在于子文件夹的处理,skip是发现子文件夹存在就不处理了,而merge会递归的处理。但是感觉这个skip的单独跳过已存在的文件夹这种特性应该用的也不多,其实感觉也有些多余了。 看看review的大佬认为这个功能需要保留吗?从使用上来说其实merge基本就能覆盖了。 |


Description / 描述
为移动和复制操作增加跳过已存在文件的选项,为复制增加合并选项。
Motivation and Context / 背景
当前移动或复制操作在未勾选覆盖文件的情况下,若存在重名文件则直接失败。在大批量的文件的操作中出现此情况时需要在页面上手动取消勾选已存在的文件,操作不方便。基于此功能可快速跳过已存在的文件。
本次新增两个选项:
skipExisting,快速跳过重名的文件,当发现目标文件夹已有重名文件时直接跳过merge,合并原文件夹下的文件到目标文件夹,仅会复制目标文件夹中不存在的文件/文件夹。其效果类似于rclone的COPY选项,目的是将原文件夹中所有新增文件/文件夹同步到目标文件夹overwrite、skipExisting、merge三者效果仅有一种生效Closes #1676
How Has This Been Tested? / 测试
overwrite选项,则skipExisting选项默认置灰overwrite选项,可手动勾选skipExisting,根据勾选结果决定跳过重复文件还是直接报错返回skipExisting的情况下,若再次勾选overwrite选项,则skipExisting与merge将被取消勾选merge的情况下,仅将目标文件夹不存在的复制过去Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。