Dos bat check file size




















Improve this answer. Anders Anders Can you explain how the "usebackq" option helps? It doesn't seem to have anything to do with file size, but if I remove it, it stops working — JoelFan. Hi Anders Can you let me know how I can do the same when I have multiple files in a sequence.

Like I want to set if my file is less than 2kb then move it to a diff folder?. My result should test each file in the path and validate.

Side note: you should check if the file exists, before. Otherwise the file size will simply be an empty string Never mind Stephen Quan Stephen Quan I prefer to use a DOS function.

Feels cleaner to me. Those are features of Windows cmd. They're completely different — phuclv. Except for the nit about not being DOS. This is the cleanest solution. HerdplattenToni HerdplattenToni 2 2 silver badges 5 5 bronze badges. As usual, VBScript is available for you to use Echo objFS.

GetFile strFile. Peter Mortensen Create a one line batch file GetFileSize. So nice. However, more disk writes. Check use count. Smylic Smylic 5 5 bronze badges. Bill Ruppert Bill Ruppert 8, 7 7 gold badges 24 24 silver badges 43 43 bronze badges. Bouvrie J. Bouvrie This is incorrect. That's because it is still a string, not converted to a number. Output is files over 2GB not MB. Work-around is: explorer filtered view i. We can get around the INT32 issue by doing it as a padded string comparison.

You'll need two things. Maybe you can get it from there if you look for it. But I am not sure. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. That is because your brain has been corrupted by "array-think" probably learned in some lame "learn to be be an admin" class or in a programing calss at you local junior college.

Arrays have not been taught as a good solution for years. Go to a shrink and have your brain purged of arrays then relearn how to write a program. Take some aspirin and things will eventually settle down. We cannot have too many brain farts. They are very messy. Note also that it is a bad idea to use "copy" or "move" for batch file names.

Lots of people have fallen into this trap: They type "copy" and the command prompt and execute their own batch file instead of the native copy command. This is not a homework problem. I used the name copy and move for the batch files for simplicity here so the assumption that I am actually doing that with these files are wrong. The idea is to solve the vbscript issue as requested. As a matter of fact I am doing some complex java work in the files I am calling. I have unfortunately not worked with vb in years and as you know if you don't exercise vb all the time you fall off.

It is not like riding a bicycle. You forget. Thanks to those who have given ideas on using a plain batch file and a vb file. I will try these and report back. Office Office Exchange Server. Not an IT pro? Resources for IT Professionals. Sign in. United States English. Ask a question. Quick access.

Search related threads. Remove From My Forums. Answered by:. Archived Forums. The Official Scripting Guys Forum!

If your answer is "yes," you know what to do. Dive in and help somebody! If your answer is "no," welcome to our fun little world! We'd recommend that you first head over to the Script Center, get your feet wet, and then come back to either ask or answer questions. We can't be everywhere at once we know—shocking! The Microsoft Scripting Guys 0 2.



0コメント

  • 1000 / 1000