Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137

    ZipsToFolders - function/Project

    Code:
    --[[
    
    This is a function that will create a folder on the system's Desktop (ZipsToFolders)...
    and then will unzip the contents of all .zip files from a (we'll call it) "master folder"...
    that is chosen by the end-user.  Here's the neat part.  This function creates folders exactly...
    matching each of the original .zip files' names and then puts all of them into the ZipsToFolders folder!
    
    I want to thank forum user Bruce for his excellent and free offering(s) of Masks.  His offering...
    inspired this function.
    
    Lastly, remember, you can play with this function, adjust it to your liking.  How about adding...
    in the ability to create a custom named folder to replace the default folder (defaults to: ZipsToFolders) of the end-users choosing?
    
    ]]
    function ZipsToFolders()
    strTargetGetFolder = Dialog.FolderBrowse("Choose a Folder containing .zip file(s)...", _DesktopFolder)
    	if strTargetGetFolder ~= "CANCEL" and strTargetGetFolder ~= "" then
    		tblFiles = File.Find(strTargetGetFolder, "*.zip", true, true, nil, nil)
    			if tblFiles ~= nil then
    				Folder.Create(_DesktopFolder.."\\".."ZipsToFolders")
    				
    				StatusDlg.Show(true, false)
    					StatusDlg.SetAutoSize(false)
    					
    					for index, path in tblFiles do
    						tblPath = String.SplitPath(path)
    							Folder.Create(_DesktopFolder.."\\ZipsToFolders\\"..tblPath.Filename)
    								Zip.Extract(path, {"*.*"}, _DesktopFolder.."\\ZipsToFolders\\"..tblPath.Filename, true, true, "", ZIP_OVERWRITE_NEVER, nil)
    					end
    					
    				StatusDlg.Hide()
    					
    			else
    				Dialog.TimedMessage("Notice!", "There were no files in this folder, aborting...", "3000", MB_ICONEXCLAMATION)
    				Application.ExitScript()
    			end
    		
    	else
    		Application.ExitScript()
    	end
    end
    
    -- Call the function (aka. use it)
    ZipsToFolders()
    Attached Files
    Last edited by Intrigued; 05-29-2005 at 12:05 PM.
    Intrigued

  2. #2
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Note: It could also use a little more bullet-proofing.

    Intrigued

  3. #3
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    Good one Intrigued.
    It will come very handy.
    Thanks a lot for that.
    Yossi

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Thanks Yosik.

    Intrigued

  5. #5
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Intrigued-
    Thanks for the kudos!

  6. #6
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by Bruce
    Intrigued-
    Thanks for the kudos!
    What goes around comes around!

    (hey, that can be a good th'ang!)

    Intrigued

Similar Threads

  1. Example: ZipsToFolders
    By Intrigued in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-29-2005, 01:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts