-
Notifications
You must be signed in to change notification settings - Fork 355
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
rename 命令为什么那么慢啊 #424
Comments
你的感觉是正确的,如果使用通配符进行批量重命名,实际上就是全部把一万个文件都便利一遍,然后把符合条件的文件名进行对应一一修改。 |
不仅仅是遍历的时候会匹配一遍,我感觉修改也全部修改了一遍。 |
这个倒不会,除非你的通配符就是匹配了所有文件才会改的,不然只会改符合条件的文件,但是哪怕符合条件的文件只有1个,扫描也是会遍历全部文件所以就慢了。 |
我试过,因为rename有个确认操作,确认之前已经遍历了一遍找到了要遍历的文件。这个过程时间不长,但确认以后,开始修改时间特别长,而且日志打出来是每个都修改了一遍。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rename 命令为什么那么慢啊,比方说一个文件夹下有1万个文件,我批量重命名匹配到的只有2个文件,按道理重命名2个文件应该很快啊,但感觉程序把一万个文件都跑了一遍。
The text was updated successfully, but these errors were encountered: