topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 11:23 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: IDEA: Find filenames/folders above certain length and offer to rename them  (Read 110511 times)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
as per title, i was thinking that a program could go through given folders recursively and report back the files/folders that are above the user-defined length and alow the user to rename them within the UI.

this will come in handy when burning cd backups. too many times, the burner complains about extra-long filenames way too late and sometimes this happens during the burning session, with a prompt holding up everything. i'm not someone who hangs around watching the whole burning session, so this program will be a good guide for me before i click the 'Burn' button. :)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
ah that's a nice idea.. maybe with some basic rules for autosuggesting new names?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
yes, some rules-based renaming suggestions will be very helpful too.

a_lunatic

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 71
  • Fulltime Single Dad
    • View Profile
    • Donate to Member
I like this Idea so many times I have had this problem.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
If you all don't mind me getting a bit of sleep, I can tackle this one later today/tonight.  What sort of rules were you guys thinking about?

Crush

  • Member
  • Joined in 2006
  • **
  • Posts: 402
  • Hello dude!
    • View Profile
    • Read more about this member.
    • Donate to Member
What kind of renaming rules could be defined?
Cut off
remove " :/\;_-|"?
delete numbers
shorten word parts with first 1-2 chars + "." or only use the characters
A really cool thing would be replacing shorter acronyms of name parts.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
If you all don't mind me getting a bit of sleep, I can tackle this one later today/tonight.  What sort of rules were you guys thinking about?

i'd like all the filenames in a flattened view (sans folder) and when i press F2, i'd be able to rename them one at a time.

for repeated usage though, some rules to shorten filenames can be:
- replace given words with another
- remove whitespace, dots, underscore
- remove vowels
- truncate user-defined chars from left or right

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,205
    • View Profile
    • Donate to Member
1-4A Rename has built-in features for shortening names for burning CDs:

Shorten filenames for CD-Rs

If you write CDs they can only can contain filenames with 64 chars or less. Thus 1-4a rename can try to

   1. Shorten the filename: deleting unnecessary spaces (additional to the above mentioned function)
   2. Destruct the filename "Remix" => "Rmx" etc.
   3. Delete space between letters and make letters uppercase: "Michael Jackson-Beat it.mp3" => "MichaelJackson-BeatIt.mp3"
   4. Delete Vowels "Stevie Wonder - Happy birthday" => "Stv Wndr - Hppy brthdy"
   5. Delete double letters: "Madonna" =>"Madona"

You will see the changes immediately plus the number of letters above 64.

Additionally you can choose to not accept changes, if the filename is still too long.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
might be nice to have it also automatically detect when there are character sets used in files that can be troublesome.

rjbull's point makes me think that, maybe the main thing this program could do is find the files whose names (including or excluding path) or too long, and then list them in an explorer-compatible window -- where one could then drag and drop them to a renamer or use F2 or normal right-click context menu to manually rename.

in other words -- the program itself wouldn't nesc. have to do anything but locate the files and present them in a way that you could use other tools to fix the names.

does seem like their could be some tricky issues though..
youd want to also put in some protection against people running this on their windows or Program Files\ directories by accident though.. shudder to think.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
1-4A Rename has built-in features for shortening names for burning CDs:

i've been using 1-4a rename but it doesn't allow any user-defined character length, only 64 chars or more is detected as too long.. anyway, i'm not looking for full-blown renamer.

as mentioned above, just a simple app that will load given folders/files, checks against user-defined length and report back the status. additionally if it allows me to rename by pressing F2 within the GUI, i'd be most happy.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
What kind of interface were you thinking?  Simple drag-n-drop listview?  Browse button instead?  Both?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
a listview display that allows that drag-n-drop would be nice but i also sometimes copy-paste the paths, so a browse dialog could come in handy.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
I was thinking a two-column listview.  The first column would be just the filename while the second would have the entire filepath (for reference).  F2 editing will be in place for the first column.  Also...the max length.  I assume this is just determined by the character count in the complete filepath, right?  I was thinking a combobox that would allow the user to enter in any number they wanted (along with some presets like 64, 128, etc).  How does this sound?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
a two-column listview would be cool but can the 2nd column be relative to chosen folder like this:

\ <- root
\abc\ <- 1st sub

and so on instead of displaying the filepath.

actually the character count that i'm looking for is the length of <filename.ext> and/or <folder>. :)

e.g.
C:\Program Files <- folder; return 13 characters
C:\PDFZilla\help.chm <- file; return 4 characters

of course, if i choose/drop a folder, there can be an option for recursive scanning.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
You have me confused.  I've been basing my assumptions on complete path lengths e.g.

c:\path\to\file.ext    <-- Returns 19.

a two-column listview would be cool but can the 2nd column be relative to chosen folder like this:

\ <- root
\abc\ <- 1st sub

and so on instead of displaying the filepath.
I need more clarification here.  Example:

Chosen/dropped path:  c:\path\to
Files in that folder: 
file_1.exe                (c:\path\to\file_1.exe)
file_2.ext                (c:\path\to\file_2.exe)
file_3.ext                (c:\path\to\file_3.exe)
\subfolder_1\file_4.ext   (c:\path\to\subfolder_1\file_4.ext)
\subfolder_1\file_5.ext   (c:\path\to\subfolder_1\file_4.ext)
\subfolder_1\file_6.ext   (c:\path\to\subfolder_1\file_4.ext)
\subfolder_2\file_7.ext   (c:\path\to\subfolder_2\file_7.ext)
\subfolder_2\file_8.ext   (c:\path\to\subfolder_2\file_8.ext)
\subfolder_2\file_9.ext   (c:\path\to\subfolder_2\file_9.ext)

Given the above, you want the listview columns to look like this:

Filename    | Path
-------------------------------------
file_1.exe  | \file_1.exe
file_2.ext  | \file_2.exe
file_3.ext  | \file_3.exe
file_4.ext  | \subfolder_1\file_4.ext
file_5.ext  | \subfolder_1\file_4.ext
file_6.ext  | \subfolder_1\file_4.ext
file_7.ext  | \subfolder_2\file_7.ext
file_8.ext  | \subfolder_2\file_8.ext
file_9.ext  | \subfolder_2\file_9.ext

Is this correct?

actually the character count that i'm looking for is the length of <filename.ext> and/or <folder>. :)

e.g.
C:\Program Files <- folder; return 13 characters
C:\PDFZilla\help.chm <- file; return 4 characters
How does "C:\Program Files" return thirteen?  Are you not counting the "c:\" portion?  If so, why?
How does "C:\PDFZilla\help.chm" return four characters?  Are you only counting the filename minus the extension?  If so, why?

of course, if i choose/drop a folder, there can be an option for recursive scanning.
Recursive scanning is assumed.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
BTW...this doesn't have to be limited to two columns.  Add more if you feel the need.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
actually the character count that i'm looking for is the length of <filename.ext> and/or <folder>. :)

e.g.
C:\Program Files <- folder; return 13 characters
C:\PDFZilla\help.chm <- file; return 4 characters
How does "C:\Program Files" return thirteen?  Are you not counting the "c:\" portion?  If so, why?
How does "C:\PDFZilla\help.chm" return four characters?  Are you only counting the filename minus the extension?  If so, why?

for the 1st one, i only need the length of the folder since the length of drive letters will be static (limited to 3 chars) and for the 2nd, i want to shorten the filename by renaming the name part only since renaming the extension will render the file unreadable except maybe in cases like .html and .htm

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
I need more clarification here.  Example:

Chosen/dropped path:  c:\path\to
Files in that folder: 
file_1.exe                (c:\path\to\file_1.exe)
file_2.ext                (c:\path\to\file_2.exe)
file_3.ext                (c:\path\to\file_3.exe)
\subfolder_1\file_4.ext   (c:\path\to\subfolder_1\file_4.ext)
\subfolder_1\file_5.ext   (c:\path\to\subfolder_1\file_4.ext)
\subfolder_1\file_6.ext   (c:\path\to\subfolder_1\file_4.ext)
\subfolder_2\file_7.ext   (c:\path\to\subfolder_2\file_7.ext)
\subfolder_2\file_8.ext   (c:\path\to\subfolder_2\file_8.ext)
\subfolder_2\file_9.ext   (c:\path\to\subfolder_2\file_9.ext)

Given the above, you want the listview columns to look like this:

Filename    | Path
-------------------------------------
file_1.exe  | \file_1.exe
file_2.ext  | \file_2.exe
file_3.ext  | \file_3.exe
file_4.ext  | \subfolder_1\file_4.ext
file_5.ext  | \subfolder_1\file_4.ext
file_6.ext  | \subfolder_1\file_4.ext
file_7.ext  | \subfolder_2\file_7.ext
file_8.ext  | \subfolder_2\file_8.ext
file_9.ext  | \subfolder_2\file_9.ext

Is this correct?

yes this is what i want but even better if the 'path' column can be further shortened. :)

like this:
Filename    | Path
-------------------------------------
file_1.exe  | \
file_2.ext  | \
file_3.ext  | \
file_4.ext  | \subfolder_1\
file_5.ext  | \subfolder_1\
file_6.ext  | \subfolder_1\
file_7.ext  | \subfolder_2\
file_8.ext  | \subfolder_2\
file_9.ext  | \subfolder_2\

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
You have me confused.  I've been basing my assumptions on complete path lengths e.g.

c:\path\to\file.ext    <-- Returns 19.

sorry if the OP was ambiguous i'd thought the rename part would help explain things. apparently not. :)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Apologies, I am still unclear as to how you want to count the path length.  You've mentioned counting folders and files differently but there will never be only a folder in a given listview row.  Every row will be a file of some sort.  In other words, this is not intended as a folder renamer, only a filename renamer.  Are we on the same page with regard to that?  For instance, based on what you said above, you want it like this:

file_1.exe  | \
file_4.ext  | \subfolder_1\
file_7.ext  | \subfolder_2\

What you want is easily doable in a GUI sense.  However, the following will never happen:

file_1.exe  | \
file_4.ext  | \subfolder_1\
file_7.ext  | \subfolder_2\
subfolder_3 | \subfolder_3\    <--- This can't happen.

If a folder is empty, nothing gets added to the listview.  Does that make sense?

So, with all that in mind, I still need to know how you want these lengths counted.  Maybe I'm not seeing the forest for the trees on this one.   :P

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
... If a folder is empty, nothing gets added to the listview.  Does that make sense?
does that mean i can't rename folders? :( i guess i can live with that.

So, with all that in mind, I still need to know how you want these lengths counted.

let me put it this way:
if the program finds this

<drive>/<folder>/<filename>.<ext>
<drive>/<folder>/<sub-folder>/<filename>.<ext>

it only returns the length of <filename>

but if it finds
<drive>/<folder>/<sub-folder>

it returns the length of <sub-folder>

finally if it's down to
<drive>/<folder>

then return only <folder>.

hope that explains things a bit. :)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Based on your counting requirements, and talking with mouser, I think I see where my confusion lies.  I've been basing my thoughts and assumptions that you are concerned with fixing full path length or, at the very least, relative path length issues.  From what you suggested in the last post, are you concerned simply with fixing long filenames or foldernames regardless of their parent path?  Is that correct?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
From what you suggested in the last post, are you concerned simply with fixing long filenames or foldernames regardless of their parent path?  Is that correct?

absolutely, that is what i want. :)

P.S. let me know if you want me to pop by the chat-room to discuss some more..

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
From what you suggested in the last post, are you concerned simply with fixing long filenames or foldernames regardless of their parent path?  Is that correct?

absolutely, that is what i want. :)

I think we're on the same page now.  Now, since there will be the ability to rename folders, I'd like to restrict this tool to working with only one given folder (and its subfolders) at a time.  The reason is that, if you rename a folder, I can do a simple rescan of the working path to refresh the listview contents.  Does this make sense?  Would this be acceptable?

P.S. let me know if you want me to pop by the chat-room to discuss some more..
I'm there almost all the time.  =]

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
I think we're on the same page now.  Now, since there will be the ability to rename folders, I'd like to restrict this tool to working with only one given folder (and its subfolders) at a time.  The reason is that, if you rename a folder, I can do a simple rescan of the working path to refresh the listview contents.  Does this make sense?  Would this be acceptable?

yes, we're on the same wave-length. i only work with one folder at a time, together with sub-folders within it. this solution suits me fine. :up:

i can't get onto the chat-room as much as i'd like to but i'll try anyway. :)