We help IT Professionals succeed at work.

renaming 2 files within a zip after downloading

We have a customer with a proprietary file share server (developed using .Net) &
whenever users download the zip, it gets blocked by IPS due to the presence of
2 files in the zip (metadata.xml & jjjjjj.config).

However, if these 2 files were renamed to some other names, the download
goes through.

Is there any way that on the client end that by clicking an icon, it will download
the zip, unzip it & then rename the 2 files back to their original names?

Do provide some sample Windows batch & PowerShell script that we can put
in script which I'll just create a Shortcut icon on the desktop
Comment
Watch Question

NVITEnd-user support

Commented:
But didn't you say it's blocked at the client end, BEFORE the user can even open the zip?

Commented:
If the file is getting blocked from downloading because of its contents then you can't download it to rename its contents.. You have to rename the files before uploading it online.. Then u can make a script that downloads the zip, unzips, renames the wrongly named files, to whatever they're supposed to be then zip back!
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
As I read it, you are after this: the files in the ZIP are already renamed, and you just need to have them named back after downloading, and you need a batch file doing all the work?
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
In short, the PS code is
# custom vars to change
$uri = "http://server.com/file.zip"
$zip = "C:\Temp\File.zip"
$dest = "C:\Temp\renamed"
#

# download and extract
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($uri, $zip)
$shell = new-object -com shell.application 
$shell.NameSpace($dest).CopyHere($shell.NameSpace($zip).Items())

# change this file names
rename-item "$dest\file1" "newName1"
rename-item "$dest\file2" "newName2"
#

remove-item $zip

Open in new window

Author

Commented:
Yes, Olemo got my requirements right.

I'll test out the PowerShell script