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)

Recommended Answers

All 2 Replies

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.

Use the Name operator

Name OldFileName As NewFileName
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.