Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get a file's modified date/time and size in bytes?
#31
Try this one simple command on your system:

Code: (Select All)
forfiles /C "cmd /c echo @fsize @file @fdate @ftime"

Open a console or powershell terminal, paste that in it, and see if it doesn't do what you want. If it does, then pipe the output to clipboard or a file and go from there with a simple SHELL call.

NOTE that forfiles has several options such as /P for path and such, and /S for recursive use in subdirectories, so take a bit to study its syntax and help info to customize it for exactly what you want it to do.

FORFILES [/P pathname] [/M searchmask] [/S]
        [/C command] [/D [+ | -] {MM/dd/yyyy | dd}]

Description:
    Selects a file (or set of files) and executes a
    command on that file. This is helpful for batch jobs.

Parameter List:
    /P    pathname      Indicates the path to start searching.
                        The default folder is the current working
                        directory (.).

    /M    searchmask    Searches files according to a searchmask.
                        The default searchmask is '*' .

    /S                  Instructs forfiles to recurse into
                        subdirectories. Like "DIR /S".

    /C    command      Indicates the command to execute for each file.
                        Command strings should be wrapped in double
                        quotes.

                        The default command is "cmd /c echo @file".

                        The following variables can be used in the
                        command string:
                        @file    - returns the name of the file.
                        @fname  - returns the file name without
                                  extension.
                        @ext    - returns only the extension of the
                                  file.
                        @path    - returns the full path of the file.
                        @relpath - returns the relative path of the
                                  file.
                        @isdir  - returns "TRUE" if a file type is
                                  a directory, and "FALSE" for files.
                        @fsize  - returns the size of the file in
                                  bytes.
                        @fdate  - returns the last modified date of the
                                  file.
                        @ftime  - returns the last modified time of the
                                  file.

                        To include special characters in the command
                        line, use the hexadecimal code for the character
                        in 0xHH format (ex. 0x09 for tab). Internal
                        CMD.exe commands should be preceded with
                        "cmd /c".

    /D    date          Selects files with a last modified date greater
                        than or equal to (+), or less than or equal to
                        (-), the specified date using the
                        "MM/dd/yyyy" format; or selects files with a
                        last modified date greater than or equal to (+)
                        the current date plus "dd" days, or less than or
                        equal to (-) the current date minus "dd" days. A
                        valid "dd" number of days can be any number in
                        the range of 0 - 32768.
                        "+" is taken as default sign if not specified.

    /?                  Displays this help message.
Reply


Messages In This Thread
RE: how to get a file's modified date/time and size in bytes? - by SMcNeill - 05-04-2025, 03:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Font Size in Threads Dimster 5 376 12-12-2025, 04:49 PM
Last Post: Dimster
  auto-detecting screen resolution for optimal window size on non-Windows systems madscijr 11 1,082 11-10-2025, 07:23 PM
Last Post: madscijr
  auto-detecting screen resolution for optimal window size on non-Windows systems madscijr 0 227 10-26-2025, 06:58 PM
Last Post: madscijr
  question on determining time spent in area fistfullofnails 9 845 08-25-2025, 01:55 PM
Last Post: fistfullofnails
  Testing against multiple elements at a time without select case CMR 4 842 04-17-2025, 02:16 AM
Last Post: CMR

Forum Jump:


Users browsing this thread: 1 Guest(s)