We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
该批次旨在报告它打算做什么,应在将其应用于实时数据之前对测试目录进行测试。
当您对结果感到满意时,请从两个
md
和移动
行中删除rem
评论关键字以激活。如果需要,可以删除echo
行。最后,
dir/s
简单地显示结果。这里的键是字符串
s ?? e ??
。通过使用
%% S
和%% T
每个设置为0
..9
依次可以看到是否存在名为* S00E*
的文件。* S99E*
存在。如果存在这样的文件,请使用%% e
和%% f
重复配方,以找到* s00e00-*
..** S99E99-*
。然后使用
/b
for Note-code>/AD 捕获文件名的列表,而无目录名称>与特定的s ?? e ??匹配,并匹配。字符串计算,并分配给%% B
。我们需要分析
%% b
,因此需要delayedexpansion
并将其转移到常规变量fullname
进行此操作。由于文件名不包含
:
,只需替换s ??
由检测到的:
:并使用for/f <
/code> 令牌和 delims 在
s ?? e ??中打破名称的选项。 - &gt; :
%% r
已在此之前设置为%% q
。%% r
在此过程中不使用。然后,这是在
%% Q
中建立子目录的问题,以及%% S
或%% s %% T
中的子标准。2&gt; nul
如果重新创建了目录,则抑制目录
消息,而&gt; nul
在上移动
命令抑制1文件移动
消息。This batch is designed to REPORT what it intends to do, and should be tested against a test directory before applying it to your live data.
When you are satisfied with the results, remove the
rem
comment keyword from the twomd
andmove
lines to activate. Theecho
lines may be removed if desired.The
dir/s
at the end simply shows the result.The key here is the string
S??E??
.by using
%%s
and%%t
each set to0
..9
in turn, we can see whether a file named* S00E*
..* S99E*
exists. If such a file exists, repeat the recipe using%%e
and%%f
to find* S00E00 -*
..* S99E99 -*
.Then grab a list of the filenames using
/b
for names-only and/a-d
for no directorynames, matching the specific S??E?? string calculated, and assign to%%b
.We need to analyse
%%b
so needdelayedexpansion
and transfer to a regular variablefullname
to do so.Since the filename does not contain
:
, simply replace theS??E??
detected by:
and usefor/f
tokens and delims options to break the name at theS??E?? -> :
%%r
is set to the part after and%%q
to that before.%%r
is not used in this process.Then it's a matter of establishing the subdirectory in
%%q
and the sub-subdirectory in%%s
or%%s%%t
.The
2>nul
suppresses thedirectory exists
messages created if a directory is re-created, and the>nul
on themove
command suppresses the1 file(s) moved
message.痛苦地提出了Ver1.0。
目前还没有傻瓜。虽然很慢。需要从那里的专家进行一些调整,也许是更好的方法,甚至大修。
非常欢迎您的建议。
寻找,你们会找到。在网中的某个地方找到了此缺失的链接,以节省我剩余的头发锁。 (任何人都知道为什么首先没有内置的instr()功能?)
希望这可以帮助他人。
Painfully came up with a ver1.0.
Not fool-proof yet but does the job for now. Kind of slow though. Needs some tuning up from a kind expert out there, maybe a far better approach or even an overhaul.
Your kind suggestions are very much welcome.
Seek and ye shall find. Found this missing link somewhere in the net just in time to save my remaining lock of hair. (Anyone knows why there isn't a built-in INSTR() function in the first place?)
Hope this can help others.