Wish: Flatten Folder

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

Wish: Flatten Folder

Post by Papoulka »

I'd like to have a native "Flatten Folder" command in XY. This would simply collect all files in a subtree and move them to the top folder there, deleting the now-empty subfolders.

I admit that this is not often needed, and most users will never have missed it. But some do, and there are these arguments for having it:

#) Flatten is an elemental "file manager" function. Really basic: find and move files. Nothing about their properties or meta-anything.

#) Flatten is not easy to accomplish with scripting. The very competent script I have is complex and still evolving after a year of use. The basic problem is that one must first throw away all knowledge of the nested files, then recreate that info by searching report strings. Special characters cause lots of problems in this.

#) Even when done with scripting, the only practical way to shift big files on external drives is with MoveTo, which invokes RichMove. That's the antithesis of flattening and there is no workaround - at least none that can be described without embarrassment on a site devoted to quality software.

#) XY is already fully equipped to deal with the only issue flatten creates: name collisions. Just include the standard flags for ask / overwrite / increment. No big GUI development, no effect on existing methods, structures, displays etc.

#) Flatten would likely be unique to XY, adding a conceptually simple and obviously useful bullet item to the list of what it can do out of the box.

I flatten thousands of folders, and have to watch XY literally jump through hoops to do each one. It really should and can be much simpler.

eil
Posts: 1888
Joined: 13 Jan 2011 19:44

Re: Wish: Flatten Folder

Post by eil »

Papoulka wrote:#) Flatten is not easy to accomplish with scripting. The very competent script I have is complex and still evolving after a year of use. The basic problem is that one must first throw away all knowledge of the nested files, then recreate that info by searching report strings. Special characters cause lots of problems in this.
actually it's possible with scripting, not easy but possible. in one script i needed to check all subs so made a loop in loop -that could make a list of paths for further move.
Win 7 SP1 x64 100% 1366x768|1900x1080

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

Re: Wish: Flatten Folder

Post by admin »

I don't know. I never flattened a folder. I do the opposite all the time. I don't see the demand for this. Bloat.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Wish: Flatten Folder

Post by Marco »

How can you call it bloat? That's a file manager duty!
Personally, I'm with papoulka, there are times when I unpack archives that it would be easier to then gather all the extracted files into the same folder and delete the unnecessary ones, instead of browsing all the subfolders. Just an example.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

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

Re: Wish: Flatten Folder

Post by admin »

OK, I don't think anybody would want "overwrite" as an option here, especially since it is unclear which file overwrites which. Same with "ask": again unclear which file would overwrite which unless I design a whole new prompt.

So, "increment" would be the hardcoded way. That way we could add "Flatten Folder" as a one-click GUI function that just does the job without asking questions (and there would be NO undo). Would that be okay? I could do that quite easily.

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

Re: Wish: Flatten Folder

Post by Papoulka »

That would be great! And "increment" is fine for me.

Though just to revisit the options... the XY Move function will already identify which file is about to overwrite another. I guess the term "hard-coded" means you wouldn't be using that function, but working at a lower level.

Thanks

prino
Posts: 358
Joined: 18 Mar 2012 21:14
Location: Vilnius, Lithuania
Contact:

Re: Wish: Flatten Folder

Post by prino »

Why not add the original folder name as prefix on collisions?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy (& W7-64 Pro @ 100%)
At last, a tiny bit of programming here... :mrgreen:

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

Re: Wish: Flatten Folder

Post by admin »

prino wrote:Why not add the original folder name as prefix on collisions?
That would be an option. (Although there are theoretical limits to it due to Windows filename contraints: max component length = 255 chars).

But is it a good option? I'd say it's only good if applied to ALL or NONE of the files. Otherwise the resulting situation would be rather confusing IMO.

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

Re: Wish: Flatten Folder

Post by bdeshi »

make a conflict resolver dialog?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Wish: Flatten Folder

Post by admin »

I prefer this to be a GUI-less feature.

Or I add it as scripting command with flags for options...

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

Re: Wish: Flatten Folder

Post by Papoulka »

Please, do the scripting command with options. That covers all cases, as it can be launched by a user button. In fact I will usually be scripting flatten in with other actions anyway, and in some cases will be glad to have the options.

Thanks!

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

Re: Wish: Flatten Folder

Post by admin »

Done, check it out...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Wish: Flatten Folder

Post by SkyFrontier »

admin wrote:
prino wrote:Why not add the original folder name as prefix on collisions?
That would be an option. (Although there are theoretical limits to it due to Windows filename contraints: max component length = 255 chars).

But is it a good option? I'd say it's only good if applied to ALL or NONE of the files. Otherwise the resulting situation would be rather confusing IMO.
This would be very nice to have. Re: len: the constraint could be easily handled by XY trimming excessive path lengths, right?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

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

Re: Wish: Flatten Folder

Post by admin »

Depends how you define "easy". It will be easy for *you* since *I* will have to solve the problem. :)

prino
Posts: 358
Joined: 18 Mar 2012 21:14
Location: Vilnius, Lithuania
Contact:

Re: Wish: Flatten Folder

Post by prino »

The PL/I compiler uses a simple first-four/last-three characters from names that are too long, you could do something similar, with a tweak to set user-defined values?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy (& W7-64 Pro @ 100%)
At last, a tiny bit of programming here... :mrgreen:

Post Reply