Bat file code for zipping Huge size files - zip

We are trying to zip a folder(size ~100GB) on our client server through a bat file. This bat file is triggered via an autosys job. The folder contains files of .dat and a .523 format file
We have tried several options like below:
1. Using PKZIP utility. While unzipping the file it says the files are corrupted and terminates the process.
2. Using Winzip. On completion of zip process, it opens a 'ADD Complete' dialogue box and waits for user to hit 'OK'. Since we are triggering the bat file from autosys, we do not see this dialogue box when we try to log on to the server. We have a interactive version on Winzip installed on server and we cannot install the wzzip version of winzip. The code we used is as follows:
SET ZIPDIR="C:\Program Files (x86)\WinZip"
CALL %ZIPDIR%\WINZIP32.EXE -a -r %CEDEARCH%\BACKUP__%date:~-4,4%%date:~-10,2%%date:~-7,2%.zip D:\DATA\Test\*.*
after executing this the above code waits for 'OK' to be hit and because of this the autosys job does not terminate. I tried to add a VBS script after it to just hit enter but it does not work.
VBS script:
set oWShell = createobject("WScript.Shell")
WScript.Sleep 2000
oWShell.Sendkeys "{enter}"
Using 7Zip. After doing some research my colleague tried to use the 7Zip and the zip and unzip works perfectly fine. No manual intervention required. The only problem is it takes around 7 - 9 hrs to complete. That's a LOT of time. Not acceptable. :(
Winzip takes around 3 hrs.
SET ZIPDIR= "C:\Program Files\7-Zip"
CALL %ZIPDIR%\7z.EXE a -r D:\PES_PROD\ARCHIVE\Calc_Backup\CALCITDBACKUP__%date:~-4,4%%date:~-10,2%%date:~-7,2%.zip D:\PES_PROD\DATA\CALC*.* -mmt
Can anyone suggest any better idea or any other method we have not thought of.
Thanks and

Related

I am not allowed to run a python executable on other pcs

I was doing a game in tkinter, then I make it executable with PyInstaller and sent it to my friends so they can run it and tell me how it feels.
It seems that they could download the file, but can't open it because windows forbade them telling that it's not secure and not letting them choose to assume the risk or something.
They tried to run as administrator and still nothing changed.
What should I do or what I should add to my code so that windows can open it without problem and why windows opens other executable files without saying that(current error that my executable gets)?
compress it as a .zip file and then it will most probably work
or install NSIS and create a windows installer for it.
I finally figured out what I had to done
When the dialog appeared u need to click more info and then it will display a Run Anyway button

Translating Linux command prompt to windows PowerShell prompt

Quick background: I previously used a remote Linux server for a project. Here I was able to pull up the Linux command window in the directory where files from another program were located, and enter a command such as lspp c= example_file.cfile -nographics. LSPP in this case is short for LS PrePost - through this command I was able to call LSPP in the background and have it reference the given *.cfile which contains various commands to be executed, such as depositing a given *.csv file with results, its name, etc.
I recently managed to install LSPP for windows locally, and am now trying to essentially translate the functionality of the command I executed in Linux, to Windows. I should add that I have no experience with CMD or Windows PowerShell...
The first thing I tried was to use cd C:\.... to set the directory to where the *.cfile is located and then enter the same lspp c= example_file.cfile -nographics from Linux, however, the response was that "lspp" was either spelled wrong or could not be found.
Next I tried setting the directory to the LSPP program folder, and using start LS-PrePost-4.7-x64 to at least start the program, but this didn't work either.
I would really appreciate it if someone could point me in the right direction here - thank you!

Py3 shutil.make_archive command runs before subprocess.Popen

I want to download a file then compress it. In my code, I have a subprocess command to download a file THEN I have a shutil command to compress it. But when executed, the shutil command runs first.
Note: "MyDownloadScript.pl" is a Perl script that downloads the needed file. For the purposes of this task, I have to download with this script.
subprocess.Popen(['perl', 'C:\\gitrepo\\BuildScripts\\MyDownloadScript.pl', '-branch', 'BranchName'])
 
shutil.make_archive(('{}\\OutputZIP'.format('outputPath'), 'zip', 'C:\\startingFolder', 'startingFile.dmg')
Despite the ordering of the functions in the code, the shutil command always runs first. Here's what happens what I run the script in different scenarios:
1) If no files exist:
Script complains it can't find the .dmg file
.dmg file is downloaded after
No ZIP produced
2) If I run the script again right afterwards (when the .dmg exists)
ZIP file is created from .dmg
.dmg is RE-DOWNLOADED
Why are these functions running seemingly out of order? Any ideas/suggestions would be much appreciated.
subprocess.Popen() is non-blocking. So it spawns a process and immediately goes to the next line in your script. Try subprocess.call() instead:
subprocess.call(['perl', 'C:\gitrepo\BuildScripts\MyDownloadScript.pl', '-branch', 'BranchName'])
 
shutil.make_archive(('{}\OutputZIP'.format('outputPath'), 'zip', 'C:\startingFolder', 'startingFile.dmg')



Launch terminal window from go lang program?

I want to have a functionality in which i will create an go program running on linux system. When that program is running it will download a zip folder from server & extract it to user HOME directory. That extracted folder will have a shell script file eg. Update.sh.
Now i want once that file is extracted i want to open the terminal & run the shell script automatically which resides inside extracted folder. Kindly gudie me can i do that ?
Have you looked at the Go standard library? Your best bet is os/exec. I don't know how feasible it would be to open another terminal and launch the script in it, but you can pipe the output of the command launched by os/exec to the stdout of the terminal in which the go program was launched.
From your question, it sounds like the go program downloading and running the script is already being run by the user on the local machine. If this is not the case, then the above will not work.

Trying to execute self extracting zip file silently in command line

I have these self extracting zip files that I'm trying to extract on 2008/7 machines remotely. But they are coming in a way of .exe and it require user to double click and choose the extractions location.
On WinZip support site they saying to use the /auto flag so the command will look like that:
C:\deploy\.exe /auto C:\path\\
It starts the process in the task manager but it stuck there foever.
When I'm opening the file in text editor it says: !This program cannot be run in DOS mode.
So maybe anyone of you know how I can automate the extraction of the self extraction file silently. Or maybe there is a way to run them with answer file.
Thanks
I know this is older, but I just found this page trying to do the same thing (for a silent driver install)
What the OP put up above works fine.
For example, my line was:
UPS_319_117.exe /auto .\upstemp\
(This was after having the batch file create the upstemp folder). My guess is either the path was wrong so the self-extracting hit an error in the OP's case, or something along those lines and it just hung up waiting for input that wouldn't happen since it was in auto mode...
You can usually unzip these using a third-party ZIP extraction utility.
I had the same problem. I eventually resolved it with PowerShell. Rename your .exe file to a .zip file. Then run a command like this:
powershell -Command "MD C:\PathWhereFileShouldExtractTo; $shell = New-Object -ComObject shell.application; $zip = $shell.NameSpace('C:\PathToZipFile\YourFile.zip'); foreach ($item in $zip.items()) {; $shell.Namespace('C:\PathWhereFileShouldExtractTo').CopyHere($item); }"
I stole the basic PowerShell commands from this article about how to unzip a file with Powershell: How to unzip a file in Powershell?

Resources