Menu

#16 "spill" AutoHotKey script submission

New
nobody
command (6)
Medium
2008-08-02
2008-08-02
Anonymous
No

Originally created by: kijoshua...@gmail.com

/*
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

Discussion

  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: tortoisesvn

    (No comment was entered for this change.)

    Labels: -Type-Defect command

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: kijoshua...@gmail.com

    Compiled version (doesn't require AutoHotKey to run)