![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-18 09:11 |
47,814 topics / 349,907 posts / today 0 new / 48,259 members |
| DOS疑难解答 & 问题讨论 (解答室) » Differential backup of files |
| Printable Version 1,547 / 8 |
| Floor1 aq217 | Posted 2006-08-17 08:40 |
| 新手上路 Posts 5 Credits 14 | |
|
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:
|
|
| Floor2 aq217 | Posted 2006-08-17 11:59 |
| 新手上路 Posts 5 Credits 14 | |
|
Is there any big brother who knows how to do it?
|
|
| Floor3 namejm | Posted 2006-08-17 14:29 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
The description is not specific enough to write specific code. Such posts should be transferred to the Batch Processing Room.
|
|
| Floor4 aq217 | Posted 2006-08-17 15:08 |
| 新手上路 Posts 5 Credits 14 | |
|
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.
|
|
| Floor5 namejm | Posted 2006-08-17 17:24 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
```
@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 ] |
|
| Floor6 aq217 | Posted 2006-08-18 14:36 |
| 新手上路 Posts 5 Credits 14 | |
| Floor7 aq217 | Posted 2006-08-18 14:56 |
| 新手上路 Posts 5 Credits 14 | |
|
If the folder A is to be changed to a network path, it is \\192.168.1.1\F$\文件夹A
|
|
| Floor8 namejm | Posted 2006-08-18 16:07 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
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.
|
|
| Floor9 smileseeker | Posted 2006-09-07 05:54 |
| 中级用户 Posts 83 Credits 316 | |
|
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 |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |