|
aq217
新手上路

积分 14
发帖 5
注册 2006-8-16
状态 离线
|
『楼 主』:
文件之差备份
使用 LLM 解释/回答一下
我要备份一个文件夹中新增加的文件.
就是要先比较目标文件夹中又哪些文件没有备份,然后把新的文件备份过来
这段代码该怎么写呀:lol::lol:
I want to back up the newly added files in a folder. That is, first compare which files in the target folder have not been backed up, and then back up the new files. How should this code be written呀:lol::lol:
|
|
2006-8-17 08:40 |
|
|
aq217
新手上路

积分 14
发帖 5
注册 2006-8-16
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
又没有哪位大哥知道 怎么做啊
Is there any big brother who knows how to do it?
|
|
2006-8-17 11:59 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
描述得不够具体,无法写出具体代码。像这样的帖子应该转往批处理室才对。
The description is not specific enough to write specific code. Such posts should be transferred to the Batch Processing Room.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-8-17 14:29 |
|
|
aq217
新手上路

积分 14
发帖 5
注册 2006-8-16
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
文件夹A 内有:1.TXT 2.TXT 3.TXT
文件夹B 内有:1.TXT 2.TXT
我想对A和B文件夹的文件进行比较,将新增加的 3.TXT 拷贝到B文件夹内
In folder A, there are: 1.TXT, 2.TXT, 3.TXT. In folder B, there are: 1.TXT, 2.TXT. I want to compare the files in folders A and B, and copy the newly added 3.TXT to folder B.
|
|
2006-8-17 15:08 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
@echo off
cd /d "文件夹A"
for %%i in (*.txt) do (
if not exist "文件夹B\%%i" copy "%%i" "文件夹B">nul 2>nul
)
explorer "文件夹A"
explorer "文件夹B"
Last edited by namejm on 2006-8-18 at 14:41 ]
```
@echo off
cd /d "Folder A"
for %%i in (*.txt) do (
if not exist "Folder B\%%i" copy "%%i" "Folder B">nul 2>nul
)
explorer "Folder A"
explorer "Folder B"
```
Last edited by namejm on 2006-8-18 at 14:41 ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-8-17 17:24 |
|
|
aq217
新手上路

积分 14
发帖 5
注册 2006-8-16
状态 离线
|
|
2006-8-18 14:36 |
|
|
aq217
新手上路

积分 14
发帖 5
注册 2006-8-16
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
如果 文件夹A 要改成网络路径怎么办
\\192.168.1.1\F$\文件夹A
If the folder A is to be changed to a network path, it is \\192.168.1.1\F$\文件夹A
|
|
2006-8-18 14:56 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
网络命令我了解的不多,也没条件测试,还是请高人出手吧。
I don't know much about network commands, and I don't have the conditions to test them. Still, please ask the experts to take action.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-8-18 16:07 |
|
|
smileseeker
中级用户
  
积分 316
发帖 83
注册 2005-3-1
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
xcopy \\192.168.1.1\F$\文件夹A L:\ /s /d /y /c >new_copy.log
/S 复制目录和子目录,除了空的。
/D:m-d-y 复制在指定日期或指定日期以后改变的文件。
如果没有提供日期,只复制那些源时间
比目标时间新的文件。
/Y 禁止提示以确认改写一个
现存目标文件。
/C 即使有错误,也继续复制。
new_copy.log中会记录你每次复制的文件
xcopy \\192.168.1.1\F$\文件夹A L:\ /s /d /y /c >new_copy.log
/S Copies directories and subdirectories, excluding empty ones.
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only files where the source time is newer than the destination time.
/Y Suppresses prompting to confirm overwriting an existing destination file.
/C Continues copying even if there are errors.
new_copy.log will record the files you copy each time
|
|
2006-9-7 05:54 |
|