|
hjxk
初级用户
 
积分 21
发帖 13
注册 2005-12-4
状态 离线
|
『楼 主』:
[已结]怎样查找相同名字的文件夹
使用 LLM 解释/回答一下
有两个装有大量电影的硬盘,硬盘内以电影名创建文件夹,两个硬盘内有很多电影是重复的,请问怎样用批处理将重复的电影查找出来,即是将两个硬盘内相同名字的文件夹查找出来并输出到一个记事本中。多谢!!
Last edited by HAT on 2008-10-25 at 18:26 ]
There are two hard drives with a large number of movies, and folders are created with movie names inside the hard drives. There are many duplicate movies in the two hard drives. How to use batch processing to find out the duplicate ones, that is, find out the folders with the same names in the two hard drives and output them to a notepad. Thanks!
Last edited by HAT on 2008-10-25 at 18:26 ]
|
|
2008-10-15 18:03 |
|
|
hjxk
初级用户
 
积分 21
发帖 13
注册 2005-12-4
状态 离线
|
|
2008-10-16 01:36 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
for /f "delims=" %%i in ('dir /ad /b /s') do (
if defined "%~nxi" (
echo %%"%~nxi"%% ==== %~i >>list.txt
) else (
set ""%~nxi"=%~i"
)
)
for /f "delims=" %%i in ('dir /ad /b /s') do (
if defined "%~nxi" (
echo %%"%~nxi"%% ==== %~i >>list.txt
) else (
set ""%~nxi"=%~i"
)
)
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2008-10-20 04:43 |
|
|
liumangshiwo
新手上路

积分 19
发帖 13
注册 2008-10-21
状态 离线
|
|
2008-10-21 14:05 |
|
|
hjxk
初级用户
 
积分 21
发帖 13
注册 2005-12-4
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
实在太菜了,看不明白,可以解释下怎样使用吗?
It's really too novice, can't understand. Can you explain how to use it?
|
|
2008-10-21 23:49 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
例如你两个硬盘在当前系统下分别为E与F盘,那么你就可以这样
for /f "delims=" %%i in ('dir /ad /b /s E:;F:') do (
if defined "%~nxi" (
echo %%"%~nxi"%% ==== %~i >>list.txt
) else (
set ""%~nxi"=%~i"
)
)
最后在批处理所在目录生成的list.txt里应就是重复目录了,不过我没测试
For example, if your two hard drives are E and F drives under the current system, then you can do this:
for /f "delims=" %%i in ('dir /ad /b /s E:;F:') do (
if defined "%~nxi" (
echo %%"%~nxi"%% ==== %~i >>list.txt
) else (
set ""%~nxi"=%~i"
)
)
Finally, the list.txt generated in the directory where the batch file is located should be the duplicate directories, but I haven't tested it.
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2008-10-22 06:21 |
|
|
slw218856
初级用户
 
积分 133
发帖 75
注册 2008-8-3
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
楼上的这局我不懂,能否解疑,先谢谢。
if defined "%~nxi" (
echo %%"%~nxi"%% ==== %~i
The game upstairs I don't understand, can you help solve it, thank you first.
if defined "%~nxi" (
echo %%"%~nxi"%% ==== %~i
|
|
2008-10-25 16:52 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
if defined var 判断是否存在变量var
因为目录名称的非规范特点,这个变量名称使用了引号来闭合,所以出现了
if defined "%~nxi"
随后是这个变量若存在,说明有重复的,那么将这个重复文件夹路径输出到list.txt
要是不存在则设置这个变量
set ""%~nxi"=%~i"
if defined var Check if variable var exists
Because of the non-standard characteristics of the directory name, quotes are used to close this variable name, so there is
if defined "%~nxi"
Then, if this variable exists, it means there is a duplicate, so output this duplicate folder path to list.txt
If it does not exist, set this variable
set ""%~nxi"=%~i"
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2008-10-26 01:31 |
|