Results 1 to 16 of 16

Thread: sorting by filename length

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,602

    sorting by filename length

    All,
    Sorry, this is not VB, but it is coding adjacent.
    I've written an app that adds lengthy text to filenames (with file details).
    I want to know if there is a way natively in Windows File Explorer to sort files in a folder by length of filename.
    Then I can see which files have been "processed" and which haven't at a glance.
    I see tons of attributes in the list view, but I don't see one that refers to name length.
    ANybody?
    Thanks.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: sorting by filename length

    1- Did you write the application in VB6?
    2- Are you USING Windows File Explorer to determine something (processed?????), or do you want to see something in VB6 that can provide your list in some sort of order.
    3- Provide an example of what two or three of your filenames might look like.

    Sam
    Sam I am (as well as Confused at times).

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: sorting by filename length

    In W7, yes (don't have 10 to test).
    You go to the directory you want, use View-Details and then on whatever tab appears (date,size,type etc), you right click on in and select "more" . You have a lengthy list over there to select what you want (length is 100% there as I see it right now that I am typing, in XP I think it was size, or something else (I remember starting with D...AH, Duration. It was duration), if by change U use XP). Again not sure for w10 but I don't see what it won't be there.
    Last edited by sapator; May 30th, 2022 at 01:43 PM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4
    Addicted Member
    Join Date
    Oct 2011
    Posts
    179

    Re: sorting by filename length

    AFAIK there is no such an option.

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: sorting by filename length

    @sapator....if you choose Length (at least in Win 10), and look at the list of files, all "Lengths" are blank....so I don't know what this "Length" is supposed to give you.

    @OP....you didn't answer my questions...would be nice to know as I am sure we could figure out something, USING VB6, that is.
    Sam I am (as well as Confused at times).

  6. #6
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: sorting by filename length

    OK.
    As I've said I don't have 10 here. After a look around, yes, totally idiotic they removed the feature. You can only do a size: search on the search bar.
    However there are some solutions by messing the registry and settings.
    Also there is a tool (haven't used) that is called TreeSize and supposedly can help. It's free,so:
    Here is all the info: https://www.guidingtech.com/sort-fil...cally-by-size/
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  7. #7
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: sorting by filename length

    If you need indentifiers in your filename, then should build filenames with a logical structure.
    Using prefixes, so you can sort alphabetically

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sorting by filename length

    Quote Originally Posted by SamOscarBrown View Post
    @sapator....if you choose Length (at least in Win 10), and look at the list of files, all "Lengths" are blank....so I don't know what this "Length" is supposed to give you.
    It's for multimedia files like videos. Enable the column and browse to a folder that contains videos and you'd see the lengths of the videos show up in the Length column, assuming the correct codecs for the videos are installed.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  9. #9
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: sorting by filename length

    AH....the LENGTH OF THE VIDEOS!

    As Arnie suggests (was my hint question early on), if it IS a VB6 app(lication) then the sensible thing to do is create a filename BASED ON THE LENGTHS (of the videos) that is then sortable WITHIN VB6.
    Not sure how many files are in question, but unless it is hundreds, it is easy to use an alphabetical prefix added to the file based upon length 'calculation'. Even hundreds or more can be 'sorted alphabetical'.
    Sam I am (as well as Confused at times).

  10. #10
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: sorting by filename length

    But who wants to sort in Explorer on the length of filename, that's a complete idiotic request
    If you store all kind of information in filenames then you are creating a kind of pseudo database table.
    What's next? Sort on the 3rd word in a filename?

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: sorting by filename length

    In Win 10, adding that LENGTH column to VIEW tab, one might get something like this, sorted by LENGTH:

    Name:  Capture.jpg
Views: 363
Size:  29.0 KB

    So, YES, you can.
    Last edited by SamOscarBrown; May 31st, 2022 at 06:57 AM.
    Sam I am (as well as Confused at times).

  12. #12
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: sorting by filename length

    That's the length of an Audio or Video file. Not the length of the filename
    And you can write extensions for Explorer, never felt the need myself but it can be done.
    https://docs.microsoft.com/en-us/win...shell/handlers

  13. #13
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: sorting by filename length

    Again, not my turf on W10 but anyone tried "TreeSize" ?
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  14. #14

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,602

    Re: sorting by filename length

    All, thanks for the replies.
    Yes, Length refers to the time length of multimedia.
    I can't order alphabetically because all of the information tags on the filename come after the original filename.
    I can definitely do this programmatically in VB6 with the FSO.
    I'm trying to have a quick way in the Windows file explorer to just look at the files in the folder in order by name length. I think, as one person has said, it simply does not exist.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  15. #15
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sorting by filename length

    Windows Explorer has a billion ways to sort files but for some reason the one thing no one thought of was sorting by file name length.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  16. #16
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: sorting by filename length

    Windows Explorer has 3 ways to sort files (not count ascending vs descending), 1 per column. A column is flagged as either a string (sorted with StrCmpLogicalW), a number (where it sorts by the raw unformatted number), a date, or enumerated groups (there's also boolean but it's not implemented). There's some subtypes and control-displaying ones but they sort indistinguishably from those.

    There's hundreds of properties, but they all sort as 1, and only 1, of those 4 ways.

    Enumerated groups I'm not even sure should be counted as separate; the only sort difference I'd have to check whether ranged values are sorted by any in the range or just as raw values. I've never seen this implemented anywhere besides the Rating column that shows those stars.

    You *could* however, add FileNameLength as a column, and sort by that, by creating a shell extension-- a Property Handler (or on XP, a Column Handler). You cannot do this in .NET or other managed code, you'd have to use something like VB6 or C/C++.

    https://stackoverflow.com/questions/...ndows-explorer

Posting Permissions

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



Click Here to Expand Forum to Full Width