+ Reply to Thread
Results 1 to 2 of 2

How to get file size from a given folder as input and categorize the files based on size

  1. #1
    Registered User
    Join Date
    02-23-2014
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    60

    How to get file size from a given folder as input and categorize the files based on size

    Greetings to Excel Forum Team!

    Please let me know if any one has a functional solution for below problem statement

    Problem Statement: How to get file size from a given folder as input and categorize the files based on size and display them in sheet1

    Is it possible to have function to get file size from a directory chosen

    For example if I have selected directory as (c:\test\)

    c:test directory / root folder contains following files

    ------------------------------------------

    SZZ-DataSet-BIData1.dat File size: 20 MB

    MQQ-DataSet-BIData2.dat File size: 5 MB

    MQQ-DataSet-BIData3.dat File size: 0 KB

    TIK-DataSet-BIData3.dat File size: 9 MB

    TIK-DataSet-BIData3.dat File size: 300 MB

    RWR-DataSet-BIData2.dat File size: 105 MB

    PLM-DataSet-BIData1.dat File size: 1 KB

    PLM-DataSet-BIData2.dat File size: 10 KB

    please note, if there are any sub folders or directories with in the (c:\test\) the function should just ignore the sub folders or sub directories.

    ------------------------------------------

    When we call above function, need to filter files based on condition like below with Function call back
    Please Login or Register  to view this content.
    ------------------------------------------

    Appreciate any help with above need.
    Thank you!
    Last edited by Leith Ross; 05-27-2015 at 05:48 PM. Reason: Added Code Tags

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: How to get file size from a given folder as input and categorize the files based on si

    FileLen Function

    Returns a Long specifying the length of a file in bytes.

    Syntax

    FileLen(pathname)

    The required pathname argument is a string expression that specifies a file. The pathname may include the directory or folder, and the drive.

    Dim MySize
    MySize = FileLen("TESTFILE") ' Returns file length (bytes).
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 9
    Last Post: 05-18-2023, 07:18 PM
  2. Cycle through all .xlsb files in a folder in size order (largest first)
    By cochise in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2014, 08:33 AM
  3. Counting files in folder including subfolders also and folder size
    By mido609 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 03:26 PM
  4. Folder Size/File Count
    By DMc2004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2006, 03:05 AM
  5. Getting number of files within a sub-folder and its size
    By Hari in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2006, 01:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1