Intrigued
05-29-2005, 01:01 PM
--[[
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()
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()