gavioto / stexbar

Automatically exported from code.google.com/p/stexbar
0 stars 1 forks source link

"spill" AutoHotKey script submission #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
/*
Takes the selected folders' contents and moves them into the parent directory.

move
<folder_path>\<folder_name>\*.*
to
<folder_path>
for all selected folders

I'm pretty sure all that stuff in the middle can be simplified to just a
few lines, but
I'm lazy today.

two boolean variables can be modified, changing the behavior of this
script.  I just leave them in here, but one could make multiple versions of
this script or add a user prompt before each run.

recursive:
essentially taking every item inside the selected
folders' trees and putting them into the respective parent directories.

destructive: 
delets all the folders made empty.  Normally only <folder_name> from the
above example would be deleted in
destructive mode.  In recursive mode, all folders involved are deleted
(after being
emptied, of course).

*/  
destructive := false

recursive := false

Loop %0%
{
    item := %A_Index%
    FileGetAttrib, Attributes, %item%
    IfInString Attributes, D
    {
        SplitPath item, name, dir, ext, name_no_ext, drive      

        if recursive
        {
            if not destructive
            {
                Loop %item%\*.*, 2, 1
                {   
                    FileMove %A_LoopFileFullPath%\*.*, %dir%
                    FileCreateDir %dir%\%A_LoopFileName%
                }
            }
            else
            {
                Loop %item%\*.*, 2, 1
                {   
                    FileMove %A_LoopFileFullPath%\*.*, %dir%
                }
            }
        }
        else
        {
            FileMove %item%\*.*, %dir%
            Loop %item%\*.*, 2
            {
                FileMoveDir, %A_LoopFileFullPath%, %dir%\%A_LoopFileName%, 2
            }
        }

        FileRemoveDir %item%, 1

        if not destructive
            FileCreateDir %item%
    }
}
QUIT:
ExitApp

Original issue reported on code.google.com by kijoshua...@gmail.com on 2 Aug 2008 at 3:36

GoogleCodeExporter commented 9 years ago

Original comment by tortoisesvn on 2 Aug 2008 at 3:39

GoogleCodeExporter commented 9 years ago
Compiled version (doesn't require AutoHotKey to run)

Original comment by kijoshua...@gmail.com on 2 Aug 2008 at 4:36

Attachments: