我有一个包含110.000个文件的文件夹,我想要一种方法将这个文件夹分成多个子文件夹,每个子文件夹包含3000个文件(也许有一个批处理脚本?)。(尝试使用WinExplorer进行复制/粘贴时,会在“准备复制”中出现问题。)
例如:
BigFolder
|
NewFolder
| | | | |
Sub1 Sub2 Sub3 Sub4 Sub5...
发布于 2017-01-07 01:44:18
我很惊讶地发现我也有同样的情况。我有30,000个文件需要排序,所以我在这个页面上问了一个问题:Fast methods to copy(move) files in batch file
这是Compo的脚本:
@Echo Off If /I Not "%__CD__%"=="%~dp0“PushD "%~dp0”2>Nul||退出/B SetLocal EnableDelayedExpansion Set "DirN=-1“:Check_DirN Set/A "DirN+=1”If Exist "%DirN%“GoTo Check_DirN Set "limit=700”For %A In (*.bat *.cmd *.txt) Do ( If Not Exist "%DirN%“MD "%DirN%”If /I Not "%%~nxA"=="%~nx0“RoboCopy ."%DirN%“"%%A”/MOV 1>NUL Set/A "limit-=1“If !limit!Lss 0 GoTo Check_DirN )Echo(任务完成!超时-1 1>Nul
这是我使用的,我为此编辑了一下:
@Echo Off
If /I Not "%__CD__%"=="%~dp0" PushD "%~dp0" 2>Nul||Exit/B
taskkill /f /im explorer.exe >nul
taskkill /f /im SearchIndexer.exe >nul
sc stop WSearch >nul
sc config WSearch start= disabled >nul
SetLocal EnableDelayedExpansion
Set "DirN=-1"
:Check_DirN
Set/A "DirN+=1"
If Exist "%DirN%" GoTo Check_DirN
cls
echo Moving files to Directory %DirN%...
Set "limit=2999"
MD "%DirN%"
For %%A In (*.html) Do (
RoboCopy . "%DirN%" "%%A" /MOV 1>NUL
Set/A "limit-=1"
If !limit! Lss 0 GoTo Check_DirN
)
Echo(Task Done!
start explorer.exe
start SearchIndexer.exe
sc config WSearch start= delayed-auto >nul
sc start WSearch >nul
Timeout -1 1>Nul
如果需要,您可以删除taskkill
、start
和sc
部件。我添加这部分是因为资源管理器和Windows Search Indexer在移动文件时会造成内存浪费。我建议您以管理员权限运行该脚本。
尝试在小范围内测试该脚本,看看它是否工作。
https://stackoverflow.com/questions/41501947
复制相似问题