如何从目录根据文件大小将文件移动到另一个目录 [英] How to move files from a directory to another directory based on file size

查看:186
本文介绍了如何从目录根据文件大小将文件移动到另一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前的工作在工作的自动化项目。一个的步骤,我需要分开是比6000KB大于从文件夹中的其他文件的文件的程序。我找了一个批处理文件,是能够打动那些比6000KB大于从当前目录复制到另一个目录中的文件。我需要这个批处理文件做处理一个批处理文件,而不是只有一个。如何做到这一点在批处理文件中有什么想法?

I am currently working on an automation project at work. One of the steps to the program that I need to separate files that are greater than 6000KB from the other files in the folder. I am looking for a batch file that is able to move files that are greater than 6000KB from their current directory to another directory. I need this batch file to do handle a batch of files and not just one. Any thoughts on how to do this in a batch file?

推荐答案

您可以用VBS使用文件对象:的文件对象引用

you can use vbs with file object: File object reference

或者你可以尝试使用此命令解压文件大小做一个.bat文件。

or you can try to make a .bat file using this command to extract the filesize.

for %%R in ([filepath and name]) do if %%~zR GTR [file size]

从该页面:<一href=\"http://social.msdn.microsoft.com/Forums/en-US/showandtell/thread/771e372f-e9c7-436a-bf08-27f39aeb196a\"相对=nofollow>批处理文件,检查文件大小

我会建议VBS选项更安全。

I would recommend the VBS options for more security.

编辑:这是用于移动文件的批处理文件。请更改&LT;移动文件方式&gt; 来一个更适当的命令

this is a batch file for moving the files. Please change the <move file> to a more appropriate command.

@echo off
for /F "usebackq tokens=3,4" %%i IN (`dir /-C`) DO CALL :MOVE_FILES %%i %%j 
exit /b 0

:MOVE_FILES
if %1.==. exit /b 0
if %1 GEQ 6000000 <move file>

这篇关于如何从目录根据文件大小将文件移动到另一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆