Page 1 of 1

Unpack Checker Script Request

Posted: 02 Feb 2010 01:15
by SkyFrontier
Is it possible for a script check a given folder so:

BASE FOLDER\level1\level2

If it encounters any subfolder (level 2 should be enough), move all its contents to level 1?
This situation is common when unpacking from .zip/.rar.
Some people pack a folder, some only its contents, so when unpacking, all must be done by hand:

...\BASE\LEVEL 1\LEVEL 2\
...\TEMP\Folder1\folder A\file1.bmp
...\TEMP\Folder1\folder A\file2.jpg
...\TEMP\Folder1\folder A\file3.jpg
...\TEMP\Folder1\folder A\file1.txt

...\TEMP\Folder2\file1.jpg
...\TEMP\Folder2\file2.bmp

...\TEMP\Folder3\folderB\File1A.doc
...\TEMP\Folder3\folderB\File2A.bmp
...\TEMP\Folder3\folderB\File3A.bmp
...\TEMP\Folder3\folderB\File1A.png

...in order to get them like this:

...\BASE\LEVEL 1\LEVEL 2 - no more!!!
...\TEMP\Folder1\file1.bmp
...\TEMP\Folder1\file2.jpg
...\TEMP\Folder1\file3.jpg
...\TEMP\Folder1\file1.txt

...\TEMP\Folder2\file1.jpg
...\TEMP\Folder2\file2.bmp

...\TEMP\Folder3\File1A.doc
...\TEMP\Folder3\File2A.bmp
...\TEMP\Folder3\File3A.bmp
...\TEMP\Folder3\File1A.png

Anyone can help, please...?

Re: Unpack Checker Script Request

Posted: 12 Sep 2010 14:55
by SkyFrontier
@Don,

Is it possible for you to implement a sort of function to check/report absolute and relative levels? With a similar approach that allowed me to build the Catalog Maker beast, I could ( :?: ) try to copy-code something that could perform a given action for files found in level 2 relative to the current folder and nothing for level 1 files - and perhaps another action for +3 level files (simple report, moving them, etc).
What about...?
Thanks!

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 04:32
by TheQwerty
Given:
...\BASE\LEVEL 1\LEVEL 2\
...\TEMP\Folder1\folder A\file1.bmp
...\TEMP\Folder1\folder A\file2.jpg
...\TEMP\Folder1\folder A\file3.jpg
...\TEMP\Folder1\folder A\file1.txt
...\TEMP\Folder1\folder A\folder B\file1.txt
...\TEMP\Folder1\folder A\folder B\file2.txt
...\TEMP\Folder1\folder A\folder B\folder C\file1.txt
...\TEMP\Folder1\folder A\folder B\folder C\file2.jpg
...\TEMP\Folder1\folder B\file1.bmp
...\TEMP\Folder1\folder B\file2.jpg
...\TEMP\Folder1\folder B\file3.jpg
...\TEMP\Folder1\folder B\file1.txt

What is the desired result?

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 08:40
by SkyFrontier
...\BASE\LEVEL 1\LEVEL 2\
...\TEMP\Folder1\folder A\file1.bmp
...\TEMP\Folder1\folder A\file2.jpg
...\TEMP\Folder1\folder A\file3.jpg
...\TEMP\Folder1\folder A\file1.txt
remains the same (minimum structure must be: ...\BASE\LEVEL 1\LEVEL 2\, no matter what BASE belongs to, be it c:\Test1\BASE or d:\Intro\Retro\Cars\BASE or whatever - BASE in this case is TEMP)

...\TEMP\Folder1\folder A\folder B\file1.txt
...\TEMP\Folder1\folder A\folder B\file2.txt
...\TEMP\Folder1\folder A\folder B\folder C\file1.txt
...\TEMP\Folder1\folder A\folder B\folder C\file2.jpg
goes
...\TEMP\Folder1\folder B\file1.txt
...\TEMP\Folder1\folder B\file2.txt
...\TEMP\Folder1\folder B\folder C\file1.txt
...\TEMP\Folder1\folder B\folder C\file2.jpg
(perhaps being renamed to "folder B_1", to avoid collision with next set)

...\TEMP\Folder1\folder B\file1.bmp
...\TEMP\Folder1\folder B\file2.jpg
...\TEMP\Folder1\folder B\file3.jpg
...\TEMP\Folder1\folder B\file1.txt
remains the same.

The basic idea is to always keep the ...\BASE\LEVEL 1\LEVEL 2\ structure.
The tricky part may be the script detecting a structure like

...\TEMP\Folder1\folder A\folder B\folder C\folder D\file1.txt
...\TEMP\Folder1\folder A\folder B\folder C\folder D\file2.txt
...\TEMP\Folder1\folder A\folder B\folder C\folder D\folder E\file1.txt
...\TEMP\Folder1\folder A\folder B\folder C\folder D\folder E\file2.jpg
and get that as
...\TEMP\Folder1\folder D\file1.txt
...\TEMP\Folder1\folder D\file2.txt
...\TEMP\Folder1\folder D\folder E\file1.txt
...\TEMP\Folder1\folder D\folder E\file2.jpg
and deal with eventual name collisions. Avoiding name collisions is desirable, but is a minor problem in the workflow I'm used to work with.
Thank you very much for trying, TheQwerty!

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 16:28
by TheQwerty
That differs from what you said in the first post... :x
Original Post:
...\TEMP\Folder1\folder A\file1.bmp -> ...\TEMP\Folder1\file1.bmp
Latest Post:
...\TEMP\Folder1\folder A\file1.bmp -> ...\TEMP\Folder1\folder A\file1.bmp
I think you're going to need to take this one back to the drawing board until you determine what it is you actually want and can illustrate that.

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 16:34
by SkyFrontier
I've decided that the second method could be a better/universal way to deal with the problem, that's why I made a more consistent post (as you asked!), even covering the longer paths scenarios, which originally I wasn't caring much.

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 16:53
by TheQwerty
And let me guess, you plan to use this on an entire drive for a few hundred thousand or million files?

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 17:24
by SkyFrontier
TheQwerty wrote:And let me guess, you plan to use this on an entire drive for a few hundred thousand or million files?
No, only for the unzipped folders out of a bunch of .zip/.rars with unknown structure that now and them contain long paths that are not of interest (only the main/level 2 *IN EXAMPLE* and the last/first with actual contents). Which may contain a few hundred thousand or million files! :D (I'm trying to get a universal tool, future-proof!)

Like this:

C:\Test\ToDo\Documents\Programs\Updated\Bin\Cream0_42_vim7_2\vim72\(first files detected here, plus subfolders!)

being auto-reduced to

C:\Test(BASE)\ToDo(Level1)\vim72(Level2)\(first files detected here, plus subfolders!)

being TEST the base folder. If the script is launched from ToDo, then structure must be:
C:\Test\ToDo(BASE)\Documents(Level1)\vim72(Level2)\(first files detected here, plus subfolders!)
Keep in mind that \BASE\LEVEL 1\LEVEL 2\ is the TARGET structure, and they can be understand as BASE (path where the script was launched from)\Level 1 (path relative to Base)\Level 2(first subfolder which contains files, which will be jumped as the first subfolder of Level 1, eliminating* every upper directories all the way up).

EDIT: *eliminating refers to "directory structure" only, not actual contents.
Like in:
C:\Test\ToDo\Documents\Programs\Updated\Bin\Cream0_42_vim7_2\vim72\(first files here)
C:\Test\ToDo\Documents\Programs\Updated\Bin\Gimp\(first files here)
C:\Test\ToDo\Documents\Programs\Updated\Bin\XnView\Portable\Bin\Documents\(first files here)

result in:

C:\Test\ToDo\vim72\(first files here)
C:\Test\ToDo\Gimp\(first files here)
C:\Test\ToDo\Documents_2\(first files here) (renamed as Documents_2 to tell this is the target folder's name, not original path's name!)

Re: Unpack Checker Script Request

Posted: 14 Oct 2010 22:44
by TheQwerty
So now you've got these (first files here), so is it supposed to remove empty directories as well?

Given this complete listing:
C:\Base\ReadMe.txt
C:\Base\Level 1a\
C:\Base\Level 1a\1a.txt
C:\Base\Level 1a\Level 2a\1a2a.txt
C:\Base\Level 1b\
C:\Base\Level 1c\
C:\Base\Level 1c\1c.txt
C:\Base\Level 1c\Level 2a\
C:\Base\Level 1c\Level 2a\1c2a.txt
C:\Base\Level 1c\Level 2a\Level 3a\
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\Level 5a\
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\Level 5a\1c2a3a4a.txt
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\Level 5a\1c2a3a4a_01.txt
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\Level 5b\
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\Level 5b\1c2a3a4a5b.txt
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\Level 5b\1c2a3a4a5b_01.txt


Is this the desired output?
C:\Base\ReadMe.txt
C:\Base\Level 1a\
C:\Base\Level 1a\1a.txt
C:\Base\Level 1a\Level 2a\1a2a.txt
C:\Base\Level 1c\
C:\Base\Level 1c\1c.txt
C:\Base\Level 1c\Level 2a\
C:\Base\Level 1c\Level 2a\1c2a.txt
C:\Base\Level 4a\
C:\Base\Level 4a\Level 5a\
C:\Base\Level 4a\Level 5a\1c2a3a4a.txt
C:\Base\Level 4a\Level 5a\1c2a3a4a_01.txt
C:\Base\Level 4a\Level 5b\
C:\Base\Level 4a\Level 5b\1c2a3a4a5b.txt
C:\Base\Level 4a\Level 5b\1c2a3a4a5b_01.txt


Why don't you just use an archive extractor that ignores path?
I really don't get what data you are receiving that you are manipulating in all of these bizarre manners. I mean script request after script request, they just seem to get further and further away from any logic.

Re: Unpack Checker Script Request

Posted: 15 Oct 2010 00:20
by SkyFrontier
This is what I need:

Code: Select all

C:\Base\ReadMe.txt
C:\Base\Level 1a\
C:\Base\Level 1a\1a.txt
C:\Base\Level 1a\Level 2a\1a2a.txt
C:\Base\Level 1b\ - Must stay - the aim is not to touch (even remaining) empty folders.
C:\Base\Level 1c\
C:\Base\Level 1c\1c.txt
C:\Base\Level 1c\Level 2a\
C:\Base\Level 1c\Level 2a\1c2a.txt
C:\Base\Level 1c\Level 2a\Level 3a\ - Must stay - the aim is not to touch (even remaining) empty folders.
C:\Base\Level 1c\Level 2a\Level 3a\Level 4a\ - Must stay - the aim is not to touch (even remaining) empty folders.
C:\Base\Level 1c\Level 5a\
C:\Base\Level 1c\Level 5a\1c2a3a4a.txt
C:\Base\Level 1c\Level 5a\1c2a3a4a_01.txt
C:\Base\Level 1c\Level 5b\
C:\Base\Level 1c\Level 5b\1c2a3a4a5b.txt
C:\Base\Level 1c\Level 5b\1c2a3a4a5b_01.txt
Why don't you just use an archive extractor that ignores path?
Ignoring paths won't work with several .zip/.rar files that were built with different path specifications, and I'm not aware of a tool which can provide such level of control when unpacking stuff.

Other application for this goes for apps that force user to use a hardcoded path structure to recognize files and handle them (namely Lighttek's Talisman Themes folder) - unzipping with/without paths can produce any kind of damage (for instance files being overwritten and the hassle of reorganizing by hand each and every folder to match a certain structure).

Apart, If you can integrate an empty folder checker and eraser which will work independently of the Unpack Checker as a secondary function I see use for that (there's a script whose function is doing that, but I'm not achieving a way to make it function anymore).
...they just seem to get further and further away from any logic.
In my case these are tools I use like at least once per week, and specifically in this case is similar to the "Move Up" thing, smarter. The weirder thing I can think of is the Remissive Index Builder (I will provide the info you asked me, when I got the time and inspiration - thank you for lending me a hand on that one, too!), which I will probably use once a month. Some of them now I just can't think about living without them, using each and every single day, several times a day for the most improbable things expected out of a file manager - that's really what makes XYplorer so great to me and I see as valid to push XYscripting limits to produce fascinating things like a mexican deletion tool, the coolest and easiest bullets & numbering generator ever, a catalog maker and an Evernote/Ditto hybrid like the data mining tool to name a few - I mean, that's amazingly great, huh?

Unfortunately I can't script all by myself, but seeing stuff I did within a 6 months timeframe based or not on community's scripts and help I'd say we're proving that XY is really a great app intended for both a larger audience and some niches which I'm yet to see filled by ANY existing tool other that XY + scripts!

Also, as you can see I'm still updating the Scripts Library, so each and every one of those pearls will not be buried - and future XY users may find similar needs and solutions so I consider all of this as a one-time job, plenty of benefits to all of us committed in spreading the word.

As a last word, thank you all for your time and work - I'm doing my best to contribute, too.

Re: Unpack Checker Script Request

Posted: 18 Oct 2010 22:24
by TheQwerty
Sorry I cannot find any logic behind what you are trying to do, and it seems each example is changing from my previous understanding..

Maybe you'll have better luck describing this to someone else.

Re: Unpack Checker Script Request

Posted: 18 Oct 2010 22:49
by SkyFrontier
Thanks for trying, TheQwerty.

Re: Unpack Checker Script Request

Posted: 18 Oct 2010 23:13
by SkyFrontier
Scratching my head...
-if only I had a way (script function?) to "Move Up" stuff and (another script function?) scan a folder for the $LL (last level) subfolders, I could jump such $LL folders say to L1, L2... ie, XY could not just count files/folders' length but also report their levels...
That way it could be possible to "Move Down" stuff to deeper levels, as well, say from L2 to L5 or LL.

Code: Select all

(drive):\L1\L2\L3\L4\LL
(drive):\L1\L2\L3\LL
(drive):\L1\L2\L3\L4\L5\LL
I REALLY miss such unpack checking/(theme manager) tool...
Also, similar request describing usage along with World of Warcraft.