topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Tuesday March 19, 2024, 5:36 am
  • 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 101996 times)

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
for a coding snack this is turning out to be quite an excercise :o

Be nice if:
one could expand the window horizontally.  Believe it or not some file names here are longer than will fit without scrolling.
highlighting on selected files could be adjusted on the fly, to match the value in the trim left/right spinners.
there were a 'trim between'.
one could select/copy directly from file names to paste into the 'custom replace' box.
there were an undo.
the tax man knocked on my door tomorrow to hand me a full, cash refund
-cranioscopical (March 23, 2009, 09:01 PM)

  • I'll have a think about this one - I actually anticipated the question, but i was more concerned with getting it functional before worrying about anything like that
  • are you asking for a 'real time' preview here?
  • should be doable
  • see above
  • in my todo list.  I need to think about this some more though
  • the cheques in the mail...

Good work so far.  This is probably one scenario you want to handle:

Files named:

file_01.jpg
file_02.jpg
file_03.jpg
...

If you trim right two places, and keep overwriting, you will end up with a single "file_.jpg" file.

many thanks, that's high praise indeed.

actually, this is pretty cool, not only have I written a file renamer, but it does compression as well!!

While I hadn't thought of this exact scenario, I knew there was always going to be a risk (hence the name).  At the end of the day we can't be protected from ourselves so there is implicitly a high level of responsibility on the user to take some care when carrying out these sorts of operations.

Having said that the idea is intriguing, but I can't quite see a strategy for dealing with it at this point  :huh:
« Last Edit: March 24, 2009, 02:01 AM by Target »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
for a coding snack this is turning out to be quite an excercise :o
Yes, I realize most of that belongs on the three-course-meal table.
I didn't intend to buffet you with requests.

Be nice if:
one could expand the window horizontally.  Believe it or not some file names here are longer than will fit without scrolling.
highlighting on selected files could be adjusted on the fly, to match the value in the trim left/right spinners.
there were a 'trim between'.
one could select/copy directly from file names to paste into the 'custom replace' box.
there were an undo.
the tax man knocked on my door tomorrow to hand me a full, cash refund
-cranioscopical (March 23, 2009, 09:01 PM)


  • I'll have a think about this one - I actually anticipated the question, but i was more concerned with getting it functional before worrying about anything like that
  • are you asking for a 'real time' preview here?
  • should be doable
  • see above
  • in my todo list.  I need to think about this some more though
  • the cheques in the mail...

-target

are you asking for a 'real time' preview here?
yes, I find it difficult to count off on the screen what the spinner will get me

the cheques in the mail... 
Uncanny!  The very words the tax man used.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
what's happened to Lanux?  I thought he might be a bit more active on this...

Yes, I realize most of that belongs on the three-course-meal table.
I didn't intend to buffet you with requests.
-cranioscopical (March 24, 2009, 10:27 AM)

that's not a problem, I'll just keep nibbling away at it. 

FYI, I haven't posted an update, but I've got both the 'betweens' and the copy/paste bits working, and I'm working on the undo list.

The list width is an issue that I'm trying to resolve as part of the undo list as well...

I'm going to need to digest the other requests some more before I do anything with them (I'd much rather produce a palatable solution than spewing out something that no one wants)

Also note that I'm off on holidays for a fortnight from Friday (back after Easter) and as I do most of this stuff on the bus to and from work I'll be taking this offline for most of that time (I will check in but not often).

If you (or anyone else) has any suggestions or requests they need to post them before CoB Friday (Australian time...) else I probably won't get to them till I'm back...
 


cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Also note that I'm off on holidays for a fortnight
Holidays! For a fortnight! Didn't you just have Christmas morning off?

Thanks for even considering these ideas. None was intended to cause a problem.

Have a good break!



Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Also note that I'm off on holidays for a fortnight
Thanks for even considering these ideas. None was intended to cause a problem.

Have a good break!
-cranioscopical (March 24, 2009, 06:50 PM)

and none has.  If it does, I'll let you know (rest assurred!!)

and I intend to...

and veering OT for a moment, what's the deal with your avatar?  for some time now I've been seeing a faint image in a red(ish) square... (affects some others as well)
« Last Edit: March 24, 2009, 07:11 PM by Target »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
for some time now I've been seeing a faint image in a red(ish) square... (affects some others as well)
-target
I'll use the blue box to recycle it.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
I guess that means it's intentional then (i thought it must have been some sort of rendering issue I was having...)

does it have some significance?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
what's happened to Lanux?  I thought he might be a bit more active on this...

don't worry, had some things to do outside. i'm glad that you took this coding snack and just ran with it. :up:

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
not a problem :up:

I'm still running, but i was looking for a bit more feedback from you on this...

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
your little app has rapidly outgrew my coding snack requirement, it's now more like a mini-renamer. i'll take a look later and will let you know. also some customisable options would be nice, such as retaining user-defined length and last-opened folder plus a log of renaming that was done.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
when you say user defined length, are you referring to the initial length filter (currently defaults to 64)?

I could save the last folder name, but what for?  (sorry, not trying to be difficult, I'm just trying to get this into context)

I'm working on an undo function, but i anticipated it being current for the life of the session only.  What would be the value of a persistent log?

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
does it have some significance?
Almost nothing that I do has significance  :)

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Almost nothing that I do has significance  :)
-cranioscopical (March 24, 2009, 10:27 PM)

sounds like my resume...

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
when you say user defined length, are you referring to the initial length filter (currently defaults to 64)?

I could save the last folder name, but what for?  (sorry, not trying to be difficult, I'm just trying to get this into context)

I'm working on an undo function, but i anticipated it being current for the life of the session only.  What would be the value of a persistent log?

* yes, i meant the initial filter length.
* it'd be more like MRU; the user can right-click the add button and recall some of the last-used folders
* i didn't know that you are working on an undo function, if so then there is no reason for the log.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
* yes, i meant the initial filter length.
* it'd be more like MRU; the user can right-click the add button and recall some of the last-used folders

* this shouldn't be a problem
* neither should this, though I'll need to think about how to incorporate it (and it's unlikely you'll see it for at least a couple of weeks... 8))

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
an update (I can't believe the traffic this thread is drawing :o) -

this is very much a work in progress (hence the BETA tag) and as such will contain extraneous bits of code and maybe some stray messageboxes (apologies for this, they're used for debugging)

  - COPY from list (CTRL+C) functionality now works
  - the BETWEEN functionality now works
  - the UNDO functionality now works

PLEASE TRY IT AND LET ME KNOW HOW IT GOES - any feedback (good, bad, or indifferent) would be appreciated

ToDo -

  - clean up the GUI and resize to fit the width of the listview controls
  - I discovered a flaw in my logic for the file/folder and recursive checkboxes which I've yet to fix (DOH!! :-[)
  - UNDOing something out of sequence (ie picking a folder somewhere down the list) can (will?) break the undo functionality for some items (as the paths may have changed
  - block editing of UNDO list
  - MRU functionality to be added
  - more 'standard' hotkeys 2B added
  - 'preview' functionality (2B investigated...)

Most of these will fit into the current incarnation, while others (preview) may require a more extensive rewrite...
 
As stated above, I really need some feedback on how this is going.  I can (and do) a certain amount of testing, but I'm a bit close to the project for this to really be effective.
« Last Edit: March 25, 2009, 09:17 PM by Target »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Thanks for the effort!

If I drag and drop files onto the list when its populated, that clears the list. (Doctor, it hurts when I do this.)
I haven't the hang of between. If I want to remove something between pos 5 and pos 9 how do I go about that?
Undo worked in my quick test.
(having internet problems tonight -- satellite feed is intermittent).

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
If I drag and drop files onto the list when its populated, that clears the list. (Doctor, it hurts when I do this.)
-cranioscopical (March 25, 2009, 07:57 PM)
take 2 asprin and sue me in the morning... actually this is/was intentional as I felt (at the time) that there could be issues with paths changing - I can change this though, I just need to assess it against everything else to try and minimise any potential conflicts

I haven't the hang of between. If I want to remove something between pos 5 and pos 9 how do I go about that?
between works using the left and right trim spinners, eg characters between the left trim and right trim values are retained... actually, having read what I've just written that is the same as trimming left AND right, so obviously I misunderstood that part...

having made a goose of myself on that point, I've now fixed the betweens (no, really) so download it again and have another go...
 
Undo worked in my quick test.
good to hear (at least I got something right...)

EDIT - removed old attachment
« Last Edit: March 26, 2009, 11:29 PM by Target »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
having made a goose of myself
-target
I wasn't very clear, eider.

With 'between' I was hoping for the ability to excise something so that, e.g.
My Music [CJRT 1991.11d.xx] 198x.xx.xx - Coffee Cantata - JS Bach.mp3
My Music [CJRT 1992.01a.xx] 198x.xx.xx - Spem in Alium - Thomas Tallis.mp3
My Music [CJRT 1995.04b.xx] 198x.xx.xx - Quartet for the End of Time - Olivier Messiaen.mp3
My Music [CJRT 1991.11c.xx] 198x.xx.xx - Piano Medley.mp3

Becomes
My Music [CJRT 1991.11d.xx] - Coffee Cantata - JS Bach.mp3
My Music [CJRT 1992.01a.xx] - Spem in Alium - Thomas Tallis.mp3
My Music [CJRT 1995.04b.xx] - Quartet for the End of Time - Olivier Messiaen.mp3
My Music [CJRT 1991.11c.xx] - Piano Medley.mp3          

                          

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
no, the issue was mine, I just started doing without actually thinking about what I was trying to do (DOH!!)

have you tried the fix? it should be working as expected now

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
have you tried the fix? it should be working as expected now
Sorry for the tardy reply, I'm struggling with connection problems.
Yes, I tried the updated version. Thanks

The 'between' setting now does chop out stuff between a 'leftpos' and 'rightpos' setting.
Never satisfied, however, I'm hoping for something that chops out material between 'leftpos_1' and 'leftpos_2' as in the example I posted above. I.e., handles fixed-position strings within names of dissimilar lengths.

If you need more time to work on this, feel free to walk to work  ;)

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
OK, how about if I ditch the betweens, and add a 'mid' option - same theory as the left/right trim, but with a starting position and the number of characters (the GUI is getting kind of squeezy  :tellme:)


1.jpgIDEA: Find filenames/folders above certain length and offer to rename them

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
[If you need more time to work on this, feel free to walk to work  ;)
-cranioscopical (March 26, 2009, 08:14 PM)

and thanks for the helpful advice (nothing like 2 brisk 75km walks a day!!)

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
OK, how about if I ditch the betweens, and add a 'mid' option - same theory as the left/right trim, but with a starting position and the number of characters
Sounds great to me! Just the job.

(the GUI is getting kind of squeezy  :tellme:)
Don't be Bashful, Doc, even if you are getting Sleepy.

and thanks for the helpful advice (nothing like 2 brisk 75km walks a day!!
Aren't you making giant strides?

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
OK, how about if I ditch the betweens, and add a 'mid' option - same theory as the left/right trim, but with a starting position and the number of characters
Sounds great to me! Just the job.
-cranioscopical (March 26, 2009, 10:26 PM)
I've got a better idea...
 
(the GUI is getting kind of squeezy  :tellme:)
Don't be Bashful, Doc, even if you are getting Sleepy.
Sleepy! That's a beauty! (though Dopey is undoubtedly closer to the mark...)

and thanks for the helpful advice (nothing like 2 brisk 75km walks a day!!
Aren't you making giant strides?
more like the Alzheimers shuffle (FYI it's called OldSimon's at our place...) (and apologies to anyone I might have inadvertently offended with these remarks)

EDIt: speling correction
« Last Edit: March 26, 2009, 11:05 PM by Target »