簡體   English   中英

Windows中的智能文件夾使用批處理文件來復制文件

[英]Intelligent folder in windows using batch file to copy files

如果文件的大小不再變化(完全處理),我想將文件從dir1移動到dir2。 可能的參與方式是詢問size0(0s)和size10(10s),如果size0 = size10,則將文件從dir1移動到dir2。

如何在Windows XP的命令行中執行此操作?

嘗試這個:

@ECHO OFF &SETLOCAL
CD /d dir1
:loop
FOR %%a IN (file) DO SET "size=%%~za"
PING -n 10 localhost >NUL
FOR %%a IN (file) DO IF %%~za equ %size% (move "%%~a" dir2) ELSE GOTO :loop

像這樣的東西可能會起作用:

@echo off

setlocal

set "file=C:\path\to\your.file"
set "destination=D:\some\folder"

:loop
call :GetSize "%file%" s1
call :Sleep 10
call :GetSize "%file%" s2
if %s1% neq %s2% goto loop

call :MoveUnlessExists "%file%"

goto :eof

:GetSize
set "%~2=%~z1"
goto :eof

:Sleep
set /a "n=%1+1"
ping -n %n% 127.0.0.1 >nul
goto :eof

:MoveUnlessExists
if not exist "%destination%\%~nx1" move "%~f1" "%destination%\"
goto :eof

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM