批處理文件將.txt移動到另一個文件夾

[英]batch file move .txt to another folder


i want ot create a batch files but i have not much experience in this.. is anyone can help me? i want to create a batch file which is the main function is to move some .txt files from a folder (A) to another folder (B)?
but those .txt that going move to other file must base by a condition and the condition is when i trigger the batch file i need to know the trigger time or current time and compare the created date and time of .txt file and it must 3 minutes and 3 second ago..
base by this condition i only do the cut and paste from folder A to B
is it doable or anyone can provide me a link so i can refer to it..
thank you very much.

我想要創建一個批處理文件,但我沒有太多的經驗...是誰都可以幫助我?我想創建一個批處理文件,主要功能是將一些.txt文件從文件夾(A)移動到另一個文件夾(B)?但那些移動到其他文件的.txt必須以條件為基礎,條件是當我觸發批處理文件時我需要知道觸發時間或當前時間並比較.txt文件的創建日期和時間它必須3分鍾和3秒前..基於這種情況我只做剪切和粘貼從文件夾A到B是可行的或任何人都可以提供給我一個鏈接所以我可以參考它..非常感謝你。

1 个解决方案

#1


0  

Yes this is do able. You need to look at robocopy and it's switches, this should see you right. Just type robocopy /? in cmd and make a note of all the switches you need as there are a lot! There will be other ways of doing this with the if statement but I'm not entirely sure about the timestamp issue. Maybe something like this:

是的,這是可以的。你需要看看robocopy和它的開關,這應該是你看對了。只需鍵入robocopy /?在cmd中記下你需要的所有開關,因為有很多!使用if語句還有其他方法可以做到這一點,但我不完全確定時間戳問題。也許是這樣的:

if %Afiletimestamp% < %Bfiletimestamp% xcopy %Afilepath% %Bfilepath% /y

if%Afiletimestamp%<%Bfiletimestamp%xcopy%Afilepath %% Bfilepath%/ y

I'm not sure how to aquire the first 2 variables though, maybe someone else can add to this?

我不知道如何獲取前兩個變量,也許其他人可以添加到這個?


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/08/22/83860d80e779a0d7fa72268369c0583b.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com