|
hover421
新手上路

积分 18
发帖 7
注册 2007-1-5
状态 离线
|
『楼 主』:
[请教]如何实现u盘和电脑的文件同步【已解决】
使用 LLM 解释/回答一下
我是一名文员 经常有多个数据表格需要分析(有时还要带回家加班) 但我有时往往忘了将在电脑上已经处理的文件拷贝进U盘 弄得经常是公司、家两头跑
请问有没有哪位达人能告诉我如何实现电脑和U盘的文件同步啊,也就是说,自动搜寻电脑中的特定文档(由于工作原因,相关数据表有时有多个,所以能搜索指定扩展名最好),并将其复制到u盘
当然,这个程序最好能自动运行 比如双击U盘 或者点击后它自动每隔1分钟复制一次。
谢谢!
Last edited by hover421 on 2007-1-10 at 08:43 AM ]
I am a clerk. I often need to analyze multiple data tables (sometimes I also need to take them home to work overtime). But sometimes I often forget to copy the files that I have processed on the computer into the USB flash drive, so I often have to run back and forth between the company and home.
Is there any expert who can tell me how to achieve file synchronization between the computer and the USB flash drive, that is, automatically search for specific documents in the computer (because of work reasons, there are sometimes multiple related data tables, so it is best to be able to search for specified extensions), and copy them to the USB flash drive.
Of course, this program preferably runs automatically. For example, double-clicking the USB flash drive or clicking it automatically copies once every 1 minute.
Thank you!
Last edited by hover421 on 2007-1-10 at 08:43 AM ]
|
|
2007-1-6 00:23 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
在电脑上工作时
start 你的程序路径
:1
sleep 60s
tasklist|findstr /i "程序名称">nul && goto succeed ::如不清楚可到任务管理器里查看!如QQ.EXE
copy "你要复制的文件" "U盘路径"
exit
:succeed
copy "你要复制的文件" "U盘路径"
goto 1
以下放入U盘根目录 1.bat
copy "你要复制的文件" "%cd:~0,1%:\U盘下一级文件夹路径"
start explorer "%cd:~0,1%
exit
以下保存为AutoRun.inf放入U盘根目录
shellexecute=..\1.bat
Icon=你的图片(bmp、ico格式等)
不想用sleep 60s的话可以用ping 1 -n 1 -w 60000 2>nul 1>nul这一句替代!!
copy可用xcopy代替,如xcopy "你要复制的文件" "U盘路径" /d /y /u 这样就只复制U盘是有且比U盘中新的文件了!
Last edited by lotus516 on 2007-1-6 at 03:10 AM ]
When working on a computer
start Your program path
:1
sleep 60s
tasklist|findstr /i "Program name">nul && goto succeed ::If you are not clear, you can check it in the Task Manager! Such as QQ.EXE
copy "The file you want to copy" "USB flash drive path"
exit
:succeed
copy "The file you want to copy" "USB flash drive path"
goto 1
The following is put into the root directory of the USB flash drive 1.bat
copy "The file you want to copy" "%cd:~0,1%:\USB flash drive subfolder path"
start explorer "%cd:~0,1%
exit
The following is saved as AutoRun.inf and put into the root directory of the USB flash drive
shellexecute=..\1.bat
Icon=Your picture (in bmp, ico format, etc.)
If you don't want to use sleep 60s, you can replace this sentence with ping 1 -n 1 -w 60000 2>nul 1>nul!!
copy can be replaced by xcopy, such as xcopy "The file you want to copy" "USB flash drive path" /d /y /u This will only copy the files that are in the USB flash drive and newer than those in the USB flash drive!
Last edited by lotus516 on 2007-1-6 at 03:10 AM ]
|
|
2007-1-6 02:08 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
把bat加入autorun.ini
Add the bat into autorun.ini
此帖被 +1 点积分 点击查看详情 评分人:【 】 | 分数: +1 | 时间:2010-4-16 20:07 |
|
|
|
2007-1-6 02:33 |
|
|
hover421
新手上路

积分 18
发帖 7
注册 2007-1-5
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
谢谢大家啊,可是我还是有一些不懂啊,首先,下面这段代码怎么处理,也是做成bat吗?
在电脑上工作时
CODE:
--------------------------------------------------------------------------------
start 你的程序路径
:1
sleep 60s
tasklist|findstr /i "程序名称">nul && goto succeed ::如不清楚可到任务管理器里查看!如QQ.EXE
copy "你要复制的文件" "U盘路径"
exit
:succeed
copy "你要复制的文件" "U盘路径"
goto 1
还有就是autorun.inf好像不起作用啊 是不是还有什么步骤啊 ?
谢谢
Thanks everyone, but I still have some questions. First, how to handle the following code? Is it also made into a bat?
When working on the computer
CODE:
--------------------------------------------------------------------------------
start your program path
:1
sleep 60s
tasklist|findstr /i "program name">nul && goto succeed ::If you are not clear, you can check it in the Task Manager! Such as QQ.EXE
copy "the file you want to copy" "USB flash drive path"
exit
:succeed
copy "the file you want to copy" "USB flash drive path"
goto 1
Also, the autorun.inf doesn't seem to work. Is there any other step?
Thanks
|
|
2007-1-6 12:32 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
|
2007-1-7 02:00 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
呵呵,这个倒是想的妙阿
”偷懒的文员“
Hehe, this is really a clever idea.
"Lazy Clerk"
|
|
2007-1-7 04:53 |
|
|
hover421
新手上路

积分 18
发帖 7
注册 2007-1-5
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
在电脑上工作时
CODE:
--------------------------------------------------------------------------------
start 你的程序路径
:1
sleep 60s
tasklist|findstr /i "程序名称">nul && goto succeed ::如不清楚可到任务管理器里查看!如QQ.EXE
copy "你要复制的文件" "U盘路径"
exit
:succeed
copy "你要复制的文件" "U盘路径"
goto 1
不好意思啊,我想我是表达出了差错,我不是要自动运行某个程序,而是想当U盘双击后(这个通过autorun.inf已经解决了,谢谢啊),电脑便自动帮我查找电脑中的数据表格文件(因为有时候很多,很杂,所以最好用扩展名查找),并复制到我的u盘,而且最好每隔一段时间还自动再复制一遍,我想这样就保持数据同步了吧,不知这样能做到吗?
麻烦大家啦!
When working on the computer
CODE:
--------------------------------------------------------------------------------
start "Your program path"
:1
sleep 60s
tasklist|findstr /i "Program name">nul && goto succeed ::If you are not clear, you can check it in the Task Manager! Such as QQ.EXE
copy "The file you want to copy" "USB flash drive path"
exit
:succeed
copy "The file you want to copy" "USB flash drive path"
goto 1
I'm sorry, I think I made a mistake in expression. I don't want to automatically run a certain program, but I want that when the USB flash drive is double-clicked (this has been solved through autorun.inf, thank you), the computer will automatically help me find the data table files in the computer (because sometimes there are many and messy, so it is best to find by extension), and copy them to my USB flash drive, and it is best to automatically copy again at intervals, I think this will keep the data synchronized, I wonder if this can be done?
Troublesome everyone!
|
|
2007-1-7 11:45 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
@echo off
echo. >txt.bak
:1
set /p word=请输入要备份的文件扩展名,如输完请直接回车:
if "%word%"=="" goto 2
echo %word% >>txt.bak
set word=
goto 1
:2
start explorer %cd:~2%
:3
ping 1 -n 1 -w 60000 2>nul 1>nul
for /f %%i in (txt.bak) do copy "你要复制的文件夹\*.%%i" "%cd:~0,1%:\U盘下一级文件夹路径"
for /f %%i in (txt.bak) do copy "你要复制的文件夹\*.%%i" "%cd:~0,1%:\U盘下一级文件夹路径"
tasklist|findstr /i "程序名称">nul && goto 3
exit
因为要监视你的程序,所以你一定要在60秒内进行你的工作,否则1分钟后将不会再自动备份!!
sorry,一个不小心 echo %word% >>要保存的文件后缀名.txt改为echo %word% >>txt.bak
多个文件夹把for一句copy几次!!
Last edited by lotus516 on 2007-1-9 at 02:25 PM ]
@echo off
echo. >txt.bak
:1
set /p word=Please enter the file extension to back up, if you have finished entering, just press Enter directly:
if "%word%"=="" goto 2
echo %word% >>txt.bak
set word=
goto 1
:2
start explorer %cd:~2%
:3
ping 1 -n 1 -w 60000 2>nul 1>nul
for /f %%i in (txt.bak) do copy "The folder you want to copy\*.%%i" "%cd:~0,1%:\The path of the next level folder of the USB flash drive"
for /f %%i in (txt.bak) do copy "The folder you want to copy\*.%%i" "%cd:~0,1%:\The path of the next level folder of the USB flash drive"
tasklist|findstr /i "Program name">nul && goto 3
exit
Because it needs to monitor your program, so you must do your work within 60 seconds, otherwise it will not automatically back up after 1 minute!!
sorry, accidentally changed echo %word% >>File suffix name to save.txt to echo %word% >>txt.bak
Copy the for sentence several times for multiple folders!!
Last edited by lotus516 on 2007-1-9 at 02:25 PM ]
|
|
2007-1-8 10:51 |
|
|
hover421
新手上路

积分 18
发帖 7
注册 2007-1-5
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
楼上的 首先谢谢你这么热心啊 不过好像这段代码没用啊 一闪就过啦,而且我也还有些疑问想问你
首先,你在第8楼给出的代码是不是和你在2楼给的后两段代码是一样功能的,可不可以分开使用啊,还是要三段代码一起使用啊
其次, 你的代码好像只能搜索一个文件夹,要是能搜索全硬盘就好啦,也就是说,是不是可以自动搜索每个目录下的扩展名相同的文件呢
最后,问一个和这个求助无关的问题,你能告诉我如何学习dos吗,基本的最简单的dos操作我已经会一点啦。
谢谢啦! 不好意思又要麻烦你啦
Upstairs, first of all, thank you so much for your enthusiasm. But it seems this code isn't working. It just flashes by. And I still have some questions to ask you.
First of all, is the code you gave in building 8 the same in function as the last two sections of code you gave in building 2? Can they be used separately, or do all three sections of code need to be used together?
Second, your code seems to be able to search only one folder. It would be nice if it could search the entire hard drive. That is to say, can it automatically search for files with the same extension in each directory?
Finally, ask a question unrelated to this request. Can you tell me how to learn DOS? I already know some basic and simplest DOS operations.
Thank you. I'm sorry to trouble you again.
此帖被 +1 点积分 点击查看详情 评分人:【 】 | 分数: +1 | 时间:2010-7-11 18:32 |
|
|
|
2007-1-9 03:48 |
|
|
lotus516
高级用户
    论坛上抢劫的
积分 551
发帖 246
注册 2006-9-21
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
不是不可以全盘搜,只是win自己有一些备份文件,如*.bak之类,全盘搜不也把它们给备份了?全盘搜的代码我也还是半懂!!!还有你的数据文件每个盘都有,不是放在一起的?8楼的是放U盘的,不和2楼的一起用,2楼后面的无时时更新,可以代替它们!!但有一点,就是运行了U盘,一定要工作!!否则不能时时更新!!学习,我以前学过,有也看大虾的贴,搜索是最好的老师,还有就是WIN自带了个老师,ntcmds.chm!!!你自己看看吧!!给个全盘的,但没时间跑,明天我再跑!!
更改了错误,全盘搜的!!文件中使用了固定路径的请自己改为你的固定路径!!!
Last edited by lotus516 on 2007-1-10 at 06:34 AM ]
It's not that it's impossible to search the entire disk, it's just that Windows has some backup files by itself, such as *.bak and so on. Doesn't searching the entire disk also back them up? I still only half understand the code for searching the entire disk!!! Also, your data files are on each disk, not placed together? The one on the 8th floor is for the USB flash drive and not used together with the one on the 2nd floor. The one behind the 2nd floor has no real-time update and can replace them!! But there is one point, that is, after running the USB flash drive, it must work!! Otherwise, real-time update cannot be done!! For learning, I learned before, and there are also looking at the posts of experts. Searching is the best teacher, and also Windows has a built-in teacher, ntcmds.chm!!! You can take a look by yourself!! Give one for searching the entire disk, but I don't have time to run it now, I'll run it tomorrow!!
Corrected the error, for searching the entire disk!! Please change the fixed path used in the file to your own fixed path by yourself!!!
Last edited by lotus516 on 2007-1-10 at 06:34 AM ]
附件
1: 2.rar (2007-1-10 06:34, 602 bytes, 下载附件所需积分 1 点
,下载次数: 34)
|
|
2007-1-9 14:22 |
|
|
hover421
新手上路

积分 18
发帖 7
注册 2007-1-5
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
谢谢lotus516,刚刚上班试用了一下你的bat,好用,真的谢谢你啦!
Thanks lotus516, I just tried your bat at work and it works well. Really thank you!
此帖被 +1 点积分 点击查看详情 评分人:【 】 | 分数: +1 | 时间:2010-7-11 18:32 |
|
|
|
2007-1-10 21:31 |
|
|