I need to create a batch file that will compress and zip all the files and folders in folder.
Once the the files and folders are zipped, the .zip file should be sent by email.
I am using Windows 7.
I dont have any idea about batch scripting. Please help.
Thanks in advance
The answer would depend on which operating system the script will run on, but you didn't even provide that.
You don't say if you are knowledgeable about any languages like C# or Java or Python, but I'd recommend writing the app in something like that. There are lots of libraries to help you with zipping, threading, etc. You might find it easier if you open up your restriction on languages.
But, if you must, here's a solution that might help you:
https://superuser.com/questions/110991/can-you-zip-a-file-from-the-command-prompt-using-only-windows-built-in-capabili
You can use 7zip for the zip functionality. Using its command line options you can create a batch file.
With regards to emails, if you really have to do it in batch then you will need a 3rd party tool, or a command line tool.
A quick google revealed this site which even has batch examples.
Related
I have to load a .htm file and save it to .xlsx file format by automation using progress? Need a solution to solve this!!
AFAIK there is nothing in Progress that will help you do this. If I had to do this, I'd look to Apache POI, which is capable of creating .xlsx fairly cleanly and has a reasonable learning curve, although it is picky about data coming into it and its error messages are typically obtuse. Using Progress directly, you could parse the .html (painfully), but creating .xlsx yourself is probably unrealistic. So, I'd also hunt around for any tools that can do this directly. Good luck.
What O/S and Progress version are you using?
If the HTML is well-formatted, perhaps you could use XML parsing to assist. I have never tried this, though.
As for writing an Excel document, there are many approaches. If you are running on a Windows box that has Excel on it, there are solutions that allow you to call the Excel libraries from inside of Progress. If you need something portable, your choices are fewer. We use ABL_xks.i, which works under both Linux and Windows. It uses the native libraries under Windows, and produces an Excel XML spreadsheat under Linux.
As I recall, there exists a library that allows you to edit an OpenOffice template (Word or Excel) from within Progress. (I would have to go searching for this, but a good place to start looking might be the OpenEdge Hive). And there several commercial packages (especially report generators) that range from using the OO template technique to full automation of Excel output.
If this doesn't point you in the right direction, fill us in with some more details about what you want to do.
I just want a simple way to create an RPM from a directory full of files. I can't seem to find any simple way of doing this online?
I know that tools such as fpm exist for doing this, but I'd like to understand the RPM build process a little so would rather not use that.
The closest I've found is:
https://www.suse.com/communities/conversations/building-simple-rpms-arbitary-files/
but I will be installing 100's of files - I don't really want to write an install command for each of them.
Any pointers appreciated.
Take a look at Jordan Sissel's FPM:
https://github.com/jordansissel/fpm
It's magic for turning one thing in to the other, package to compressed directory and back.
The rpmerizor (http://rpmerizor.sourceforge.net/) may be of interest. The web page also lists other tools (including fpm) that do this kind of thing.
I need a way to merge PDF files on Windows using perl, it has to be perl because it is part of my script to organize a directory on Windows server. Any ideas?
See this very related question: How can I merge PDF files with Perl.
If the CAM::PDF module doesn't suit you (if you can't get it on your Windows environment), the pdftk mentioned there is available for Windows (see Installing pdftk). You can use that from your perl scripts.
Please have a look at the PDF Processing with Perl article for other options.
It's not trivial to write a program that parses two PDF files, manipulates them, and writes them back out as a single merged file. But if I were to dive into the task I would probably use the cpan module PDF::API2. It seems to be one of the most complete and most robust PDF modules on CPAN, though not necessarily the simplest to figure out. There are other PDF modules under the PDF::* heirarchy on CPAN, and some of them may provide just enough functionality for you, with less of a learning curve.
But let me suggest something else: If you can find a ready-made tool that will merge two PDF files, you could allow Perl to send the files through that program, and retrieve the results. This might be a simpler approach, and one that you can be reasonably certain already works (as opposed to you spending a lot of time debugging your own solution). Your existing Perl script could interface with an external program that already has the capability you need.
I need to create a batch file which will copy web log files from a web server to a local desktop box on daily frequency.
I'm a web developer, but I'd like to take a stab at learning the process for creating a batch file and I think using the windows scheduler should get me where I need to go.
In any case, I'm just looking for a jumping off point.
I understand the premise behind a batch file (echo to print info, commands to cause actions such as mkdir or move, etc), but some straight forward tutorials would be great.
Or even a reference guide such as devguru.com or 4guysfromrolla.com would be helpful.
Thanks,
Creating a batch file is relatively straightforward.
Just type out the commands you want as you would in the command shell, and save the file with a .bat extension.
There's a simple example here that you may find useful. Note, you can use any editor to create your batch file, as long as it saves in a text format.
Depending on which version of Windows you're using, the process to create a scheduled task is slightly different:
Windows XP
Windows Vista
Edit: A little followup on misteraiden's answer.
Essentially, what you're looking for is scripting functionality. There are a variety of tools available. A batch file is the simplest form of scripting that Windows supports. You could, for example, write scripts in PowerShell or Python. Both are more powerful and flexible scripting languages. Depending on what the requirements are for your script, and what you feel like learning, they may be more appropriate.
However, If all you want to do is a copy, the simplest, easiest place to start is a batch file.
This is a little left-of-field, but using an XML build interpreter such as NAnt could come in handy here. Probably over-kill for what you are trying to do, but if you learn it now, you'll be able to apply it's uses in many different places.
You could use Windows Scheduler to trigger the build, which would then complete various operations such as deleting, copying, logging on to network shares.
However, perhaps to learn this you would probably need to learn more about the command line and command line programming.
Either way, I recommend you check out some of the NAnt examples that deal with copying and other basics etc..
I found one of the best references other than the Microsoft website that was mentioned in an earlier is: http://www.robvanderwoude.com/batchfiles.php I have been using this for many of the issues I have had and have been using it to learn more. I think since you have the premise of how batch files work, this will work out will for you.
How can I append my own exe to upgrade it with c programming. I have tried to use append mode in exe but helpless with it. Any way to modify any exe? There are simpler process for .txt but none for .exe.
I want to add the codes or join the functions just like any program updates.
It's not that simple. You can't (simply) add code to the end of an .exe file to modify it; there are internal indexes, tables, etc.
For software update you need to replace the file in question with a newer versions. There are frameworks for doing that in an easy and automated way. If you tell is what language and environment you are using, someone is sure to recommend a good software update solution.