954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Rename contents of zip file on extraction?

Does anybody know of a way to rename the contents of a zip file when they're extracted?

I have a program which grabs zipped files from an outlook account, gives them a unique name, saves them to a network repository, then extracts the contents to a sub folder in that repository.

However, I need to be able to rename the excel files which reside in the zip file. Here's the code which reads the filename (source = a) and drops it on the network, then does an extraction via WinZip. Any ideas?
Thanks!

Source = a

If InStr(1, Source, " ", vbTextCompare) <> 0 Then Source = Chr(34) & Source & Chr(34)
Dest = "C:\OUTLOOKTEMP\unzipped\"
If Dir(Dest, vbDirectory) = "" Then MkDir Dest
If InStr(1, Dest, " ", vbTextCompare) <> 0 Then Dest = Chr(34) & Dest & Chr(34)

ZipIt = Shell _
    (WinZipPath & "Winzip32.exe -min -e " & Source & " " & Dest, vbNormalFocus)
JP Romano
Newbie Poster
8 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

1) you could store them in different directories.

2) extract a file, rename it, then extract another file. Do that for each of the zip files.

Ancient Dragon
Retired & Loving It
Team Colleague
30,050 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Use the Name operator

Name OldFileName As NewFileName
vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You