Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Echo. >>smallfiles.txt file names less than 200k in size???  (Read 3515 times)

0 Members and 1 Guest are viewing this topic.

DaveLembke

    Topic Starter


    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Echo. >>smallfiles.txt file names less than 200k in size???
« on: December 28, 2010, 08:47:07 PM »
Was wondering if anyone had any suggestions on a way to search through a directory for files less than 200k in size and write them as a ascii text file.

I know how to write the output from DOS to a file, but I need to find a way to find files that are less than 200k in size from DOS on a Windows XP Pro SP3 system.

* The reason for why the solution is not as easy as a one time use of windows explorer to just sort by file size and then move files to another folder and then perform a DIR command with >>smallfiles.txt is that I want to add this to an automated process that checks and corrects for files that are too small to be correct. Another program that I wrote in C++ will read in the list of file names from that text file and rerun the process for those tasks that were executed with bad file results.

Any language can be used to make this happen, and I was curious as to if batch could be used or if a vbscript or other language would be necessary and if so, how do go about grabbing file names less than 200k in size?

ghostdog74



    Specialist

    Thanked: 27
    Re: Echo. >>smallfiles.txt file names less than 200k in size???
    « Reply #1 on: December 28, 2010, 11:32:26 PM »
    if you want a native solution you can use vbscript. See here for an example.
    If you can afford to download stuff, you can use GNU find for windows with -size option.

    Of course, since you are already coding in C++, why not just use C++? Otherwise, languages like Perl/Python etc can also find file sizes for you.

    DaveLembke

      Topic Starter


      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Echo. >>smallfiles.txt file names less than 200k in size???
    « Reply #2 on: December 29, 2010, 04:03:40 AM »
    Thanks! The VBScript link will pobably be most helpful to me. I searched and didnt come across it here prior to posting. Not sure how I missed it when the subject is just about the same.

    Salmon Trout

    • Guest
    Re: Echo. >>smallfiles.txt file names less than 200k in size???
    « Reply #3 on: December 29, 2010, 11:47:21 AM »
    I was curious as to if batch could be used

    Code: [Select]
    @echo off
    for /f "delims=" %%A in ('dir /b /a-d') do (
        if %%~zA lss 204800 echo file %%A is less than 200 kB
        )

    DaveLembke

      Topic Starter


      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Echo. >>smallfiles.txt file names less than 200k in size???
    « Reply #4 on: December 29, 2010, 02:30:36 PM »
    Thank You Salmon Trout for showing a way to do this in batch!!!!! 8)