I am trying to copy files out of zipped folders using FileCopy. Here is a very simple example command:
^g::
FileCopy, C:\Users\User1\Desktop\zippedfolder.zip\sometextfile.txt, C:\Users\User1\Desktop
This command only seems to work with non-zipped folders and I'm not sure why. Any suggestions?
Copying Files Out of Zipped Folders
-
- Posts: 3
- Joined: 26 Jun 2017, 17:46
Re: Copying Files Out of Zipped Folders
If you can show me any indicator that FileCopy is meant to extract files from a zipped archive I owe you a beer. OK, let's see ...This command only seems to work with non-zipped folders and I'm not sure why.
https://autohotkey.com/docs/commands/FileCopy.htm
Re: Copying Files Out of Zipped Folders
- I would look at 7-Zip command line. Best of luck.
- I don't think FileCopy can do this.
- I couldn't find a way to do this via Windows itself, via the command line.
- There might be a Winapi dll function for this?
[I found this link which uses an object method:]
vbscript - Can Windows' built-in ZIP compression be scripted? - Stack Overflow
https://stackoverflow.com/questions/302 ... e-scripted
[EDIT: This link appears to do the same thing in AHK, thanks BoBo, I was just searching for such a script.]
Native Zip and Unzip XP/Vista/7 [AHK_L] - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/6070 ... ta7-ahk-l/
- I don't think FileCopy can do this.
- I couldn't find a way to do this via Windows itself, via the command line.
- There might be a Winapi dll function for this?
[I found this link which uses an object method:]
vbscript - Can Windows' built-in ZIP compression be scripted? - Stack Overflow
https://stackoverflow.com/questions/302 ... e-scripted
[EDIT: This link appears to do the same thing in AHK, thanks BoBo, I was just searching for such a script.]
Native Zip and Unzip XP/Vista/7 [AHK_L] - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/6070 ... ta7-ahk-l/
Last edited by jeeswg on 27 Jun 2017, 06:39, edited 3 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Copying Files Out of Zipped Folders
Maybe someone is able to cross-check this/bring it back to life: [native-zip-and-unzip] ... and mentioned at the same thread, [ ... a COM option]jeeswg wrote:I would look at 7-Zip command line. Best of luck.
There might be a Winapi dll function for this?
Last edited by BoBo on 27 Jun 2017, 08:44, edited 1 time in total.
Re: Copying Files Out of Zipped Folders
Well, this worked for me (I created a zip via 7-Zip and extracted it using one of the functions from the link above):
Code: Select all
;Native Zip and Unzip XP/Vista/7 [AHK_L] - Scripts and Functions - AutoHotkey Community
;https://autohotkey.com/board/topic/60706-native-zip-and-unzip-xpvista7-ahk-l/
q:: ;extract files from zip file
vPathZip = %A_Desktop%\MyZip.zip
vDirOutput = %A_Desktop%\MyZip
Unz(vPathZip, vDirOutput)
return
Unz(sZip, sUnz)
{
fso := ComObjCreate("Scripting.FileSystemObject")
If Not fso.FolderExists(sUnz) ;http://www.autohotkey.com/forum/viewtopic.php?p=402574
fso.CreateFolder(sUnz)
psh := ComObjCreate("Shell.Application")
zippedItems := psh.Namespace( sZip ).items().count
psh.Namespace( sUnz ).CopyHere( psh.Namespace( sZip ).items, 4|16 )
Loop {
sleep 50
unzippedItems := psh.Namespace( sUnz ).items().count
ToolTip Unzipping in progress..
IfEqual,zippedItems,%unzippedItems%
break
}
ToolTip
}
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Copying Files Out of Zipped Folders
Thx for sharing thisGuest wrote:ZipFile class by coco https://autohotkey.com/boards/viewtopic.php?f=6&t=3892
-
- Posts: 3
- Joined: 26 Jun 2017, 17:46
Re: Copying Files Out of Zipped Folders
Thank for the reply, all. But I think I found a suitable work around. In my company, we download reports and a bunch of these text files come within numerous zipped folders. Its very tedious to sort them all and place them in the appropriate folders. I automated the sorting process with autohotkey but could not automate the extraction process. I just assumed since a zipped folder is a type of folder, there would be a filepath to specify the location of its contents and I was just typing the path wrong with FileCopy. Ultimately, I decided to open zip folder, select all files via send ctrl+a, send ctrl+c, make desired folder active, and send ctrl+v. But thanks for the reply everyone!
Who is online
Users browsing this forum: Ineedhelplz, jaka1, penguinautomator, Spawnova and 279 guests