Wish: Flatten Folder

Features wanted...
Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: Wish: Flatten Folder

Post by Papoulka »

Thank you for the function which works very fast compared to scripted alternatives.

However, there is one significant problem: it affixes an increment number to every file moved. I thought it would only do that to resolve a collision, which would be much better.

A minor issue is that if any of the path being flattened is more than 259 chars the command reports that it "can't find" the folder it's being used in. That's a puzzling message. Maybe something more clear is possible.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wish: Flatten Folder

Post by admin »

Always increment: Whoops, that's a bug, of course. Fix comes.

If any of the path being flattened is more than 259 chars: No problem here. :? Can you post a screenshot of that message? Maybe I can see where it comes from.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: Wish: Flatten Folder

Post by Papoulka »

I've now tried a few cases with a ::fresh install of v15.60.0005. The "system cannot find the path specified" error reported earlier was because "Support Overlong Filenames" was disabled. With that enabled, there is no error. .

The only problem I have found with this new version is that it does not operate on the current folder but always one folder deeper. E.g. my folder structure is:

C:\Temp\Flatest\Sub1\Sub2\file.txt

I have C:\Temp\Flatest open in the List pane (and that path appears in the Address Bar). In the List pane I can see the folder "Sub1" but it is not selected. If I run the script

Code: Select all

flattenfolder(, "");
it will actually operate on Sub1. The resulting structure is C:\Temp\Flatest\Sub1\file.txt. But I want it to be C:\Temp\Flatest\file.txt. I get the same result if I run

Code: Select all

flattenfolder(<curpath>, "");
From the log notes, I understand that Flatten() will operate on Sub1 if that folder is selected. But with nothing selected and/or with <curpath> specified, I think it should flatten the current (open in List pane) folder.

BTW, the safety prompt still says there is no Undo. The Undo is way cool.

Thanks for all the work on this.
Last edited by Papoulka on 24 Aug 2015 20:50, edited 1 time in total.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wish: Flatten Folder

Post by admin »

It says "focused", not "selected".

But I agree that would be better to use only the selected folder.I will change it.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Wish: Flatten Folder

Post by bdeshi »

regarding overwrite security, consider replacing the s flag with say, x, to turn OFF that prompt.
That will take a conscious effort from the scripter's part to avoid that step.

Right now, I might use any flag, forget s, therefore override it and make a mess.
With 'x', I'll have to specifically type it in when trying to skip the prompt. No punishment for forgetfulness. :)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wish: Flatten Folder

Post by admin »

Good point! :tup:

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Wish: Flatten Folder

Post by Filehero »

OT because of :?

Code: Select all

If List has focus and a folder is focused in List
Is this ever possible? Over here, if a defocused list has a focused folder this folder will become selected when the list regains focus.

I expect to add some :oops: :oops: soon. :mrgreen:

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wish: Flatten Folder

Post by admin »

Ha, you don't know what "focused" means. :P

In each list exactly one item must have the focus. This is totally independent of any selections. The focus controls which item is affected by keyboard action, that's all.

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Wish: Flatten Folder

Post by Filehero »

admin wrote:Ha, you don't know what "focused" means. :P
Some truth in it, otherwise your reply wouldn't have made me look into my list config again -> Highlight Focused Item was unchecked! :shock:

So I think :oops: :oops: are deserved - and sufficient. :wink:

Thanks.

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Wish: Flatten Folder

Post by LittleBiG »

Warning says flattenfolder cannot be undone, but undo works anyway. By the way, undo couldn't create the deleted empty folders.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wish: Flatten Folder

Post by admin »

No? Strange. I can here. :?

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: Wish: Flatten Folder

Post by Papoulka »

This is great! Runs slick, replacing a complex script (given to "UDF can't call itself" failures) AND an über-clunky AutoIt adjunct exe. Much appreciated.

highend
Posts: 14993
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Wish: Flatten Folder

Post by highend »

6-7 lines are a complex script? :ghost:

I think I should only write one liners in the future :mrgreen:
One of my scripts helped you out? Please donate via Paypal

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: Wish: Flatten Folder

Post by Papoulka »

6-7 lines are a complex script? :ghost:
...But they were highend lines. Those count differently :wink: . Plus I added clever stuff of my own to make it all "better". Anyway, I used your Flatten script thousands of times and was really glad to have it, so thanks for all you did that way.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wish: Flatten Folder

Post by admin »

Has anybody (beyond LittleBiG) problems with the Undo of FlattenFolder?

Post Reply