scan zip files and move files to another directory using a batch file from the command line on windows - windows

I am working on a batch file and trying to write the correct windows commands.
1) Command-line from Windows
2) Use commands to scan the zip file so that it will look inside of the zip file for a specific string in the file within the zip file.
3) If the scan finds that specific string in the file that is within the zip file then move that zip file to another specified directory.
Is it possible using dos commands within a batch file?
I want to learn more on this. Anyone have any guidance or suggestions?

Related

Installer for a .bin file that will run on Ubuntu

I have a .bin file that will comprise of 3 files
1. tar.gz file
2. .zip file
3. install.sh file
For now the install.sh file is empty. I am trying to write a shell script that should be able to extract the .zip file and copy the tar.gz file to a specific location when the *.bin file is executed on an Ubuntu machine. There is a Jenkins job that will pull in these 3 files to create the *.bin file
My Question is how do I access the tar.gz and .zip file from my shell script ?
There are two general tricks that I'm aware of for this sort of thing.
The first is to use a file format that will ignore invalid data and find the correct file contents automatically (I believe zip is one such format/tool).
When this is the case you just run the tool on the packed/concatenated file and let the tool do its job.
For formats and tools where that doesn't work and/or isn't possible the general trick is to embed markers in the concatenated file such that the original script ignores the data but can operate on itself to "extract" the embedded data so the other tool can operate on the extracted contents.

Making single executable includes all program file and folders with nsis?

I have zip file containing my installation files. I'm extracting this zip and copying these files into installation directory with the script shown below:
ZipDLL::extractall "$OUTDIR\demo.zip" "C:\myapp\demo\"
if I remove zip file from $OUTDIR than installer is not able to find zip file as expected. What I want to do is embedding this zip or its extracted folders into exe itself. I added
File -r "$OUTDIR/demo"
but this script didn't worked as well.
When you use the ZipDll plugin, you are referring to the file you want to process (demo.zip) by using its place at run time: along the installer.exe.
When you use the File statement to embed some files into the produced installer, you need to refer to the files by using their place at compile time.
Replace the $OUTDIR in the File statement by the path relative to the .nsi script.
BTW, you should take the habit to check at the compilation log, NSIS probably tells you about that kind of problem when paths are incorrect at compile-time.

Converting a .exe to .pl in Perl?

I'm trying to get a Perl script (.pl) out of an executable (.exe) file. The .exe file was originally coded in Perl but the .pl file was not kept. Is there a quick way to do this? I'm using Strawberry Perl for windows.
Thanks
Rename .exe to .zip and check if files can be extracted
From the PAR FAQ:
How do I extract my script out of packed executable?
In other words, "I did a `pp foo.pl' and I lost foo.pl, how do I get it back?".
The answer is to just use unzip/winzip/winrar/whatever to decompress the executable, treating it like a normal Zip file. You may need to rename the executable into a .zip extension first.
pp relies on PAR to create the executable. PAR relies on Archive::Zip, so at some level the file contains zipped copies of the perl scripts used to create the executable.
Typically, these programs attach a loader to the front of a zip archive which unzips the files to a temporary directory and invokes the script indicated as the program's entry point.
I'd try two things:
root around in all the typical Temp directories (\Users\Username\AppData\Local\Temp for instance) for a directory containing your script and it's prerequsites.
try to uncompress the exe as a zip, possibly removing the loader from the start of he program first, using a byte editor.

How Do I COPY a file with special characters in the filename in a .BAT file?

I am generating a .BAT file containing nothing but COPY commands to move some files around.
Here is an example working command:
COPY "C:\TEST.PDF" "D:\TEST.PDF"
Here is an example that isn't working:
COPY "C:\édf.pdf" "D:\édf.pdf"
Can I copy this file using a windows batch file? Or do I have to rewrite my script in a language like PERL?
The examples I gave do work. I noticed that inside my .BAT file those special characters were getting lost because of the .BAT file's encoding.

Retrieve zip file from a predefined ftp link using bat or cmd file

I have a pre-defined ftp link with a zip file on the other end that I want to save to a directory on my cloud server (running Windows Server 2008). Once the zip file has been saved to a specified directory, lets say "c:\MyZipFiles\ZipFile-1.zip" for example, I want to unzip the file so that all files contained within the zip file are accessible within the same directory. I'm currently doing this manually and I want to automate this process by creating a .bat or .cmd file that will perform these steps for me.
Once the zip file is unzipped, I have a task in the Task Scheduler of Windows Server Manager ready to use the unzipped files for other things.
The pre-defined link looks something like this:
ftp://idx.realtor.com/idx_download/files.zip
I would greatly appreciate anyone who can help me with this...
Batch file
ftp -s:ftp_cmds.txt host-name-goes-here
unzip local-file.zip
exit
ftp_cmds.txt
username-goes-here
password-goes-here
cd remote-directory-goes-here
get files.zip local-file-name-goes-here.zip
quit
This the batch file uses "unzip" to unzip the archive you can find it here: http://gnuwin32.sourceforge.net/packages/unzip.htm
Either put the binaries in the same directory or put them somewhere else and set your windows PATH
I used my own ftp to test most of this. Your ftp was offline for me, so it might take some tweaking but this should put you in the right direction.

Resources