简体   繁体   English

Windows中的智能文件夹使用批处理文件来复制文件

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

I would like to move a file from dir1 to dir2 if its size is not changing anymore (fully processed). 如果文件的大小不再变化(完全处理),我想将文件从dir1移动到dir2。 A possible attend would be to ask size0(at 0s) and size10(at 10s) and if size0=size10 than move file from dir1 to dir2. 可能的参与方式是询问size0(0s)和size10(10s),如果size0 = size10,则将文件从dir1移动到dir2。

How to do it in command line on windows xp? 如何在Windows XP的命令行中执行此操作?

try this: 尝试这个:

@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

Something like this might work: 像这样的东西可能会起作用:

@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.

相关问题 使用Windows批处理文件将多个文件从具有相同文件名的不同文件夹复制到一个公用文件夹 - Copy multiple files from different folder with same filename to one common folder using windows batch file 使用批处理文件创建文件夹并将文件复制到多台PC - Using a batch file to create folder and copy files into it to multiple PCs 使用批处理文件复制文件 - Copy Files using a batch file 如何使用此批处理文件将所有* .txt文件从子文件夹复制到批处理文件文件夹? - How to copy all *.txt files from subfolder to batch file folder using this batch-file? 有没有一种方法可以将带有批处理文件的文件复制到该批处理文件所在的文件夹中? - Is there a way to copy files with a batch file to the folder that batch file is in? Windows批处理文件,用于复制额定文件 - Windows Batch File that Copy Rated Files 使用Windows批处理脚本复制最新的2个文件 - Copy latest 2 files using Windows batch script Windows批处理将文件从子文件夹复制到一个文件夹 - Windows batch copy files from subfolders to one folder 使用批处理复制脚本复制文件仅将第一个文件复制到目标文件夹 - Copying files using Copy in batch script copies only the first file to the destination folder 使用批处理将文件从 windows 复制到 android - copy file from windows to android using batch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM