DOS: How to create a batch file that will move file based on files

G

Guest

Does anyone know where I can find (or create) a DOS batch file that will move
a file to a desired folder based on the file size?? For example, if my.log
reaches 200MB in size, move it to the Archive folder.

thanks.
 
R

Richard In Va.

Hello Brandon,

Not sure how it might be done with a Win-XP DOS batch file.

But XXcopy will do it...
http://www.xxcopy.com/index.htm

Very similar to using xcopy.exe accept many more options.

It's a free download for personal use. You will use it within your batch
files. It offers many command line switches and several deal with target
file size as your looking for.

I've been using it for system backup/synchronizing. Quite pleased with it.

Read thru the user manual (on-line or in the downloaded zip file)
Or maybe it's...

C:\Windows\system32\xxcopy /help

.... or something.


Hope this is helpful!

Best regards,
Richard in VA.
+++++++++++++++++
 
P

Pegasus \(MVP\)

Brandon said:
Does anyone know where I can find (or create) a DOS batch file that will move
a file to a desired folder based on the file size?? For example, if my.log
reaches 200MB in size, move it to the Archive folder.

thanks.

As Richard suggested, xxcopy has this type of function inbuilt.
Very nice and powerful product. DOS itself cannot do it this
sort of thing (remember that DOS is an obsolete operating system)
but the Command Prompt under Windows can. It works like this:

@echo off
for %%a in ("c:\My LogFiles\backup.log") do if %%~za GTR 200000000 move
"c:\My LogFiles\backup.log" d:\Archive

Unwrap the second line!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top