Batch script to archive logs by zipping - batch-file

I have a requirement for a batch script. I have log file under below directory (actually multiple directories with different names under E:\TIBCO\).
E:\TIBCO\*\6.0.0\LogFiles with Spotfire.Dxp.Automation.*.*
I need to perform below steps with the batch script
move (copy and delete) all the files that are with Spotfire.Dxp.*.*.* (ex Spotfire.Dxp..1.) from the above paths to E:\TIBCO\logsArchival\rotatedDir
zip all the files that are older than 60 from E:\TIBCO\logsArchival\rotatedDir to E:\TIBCO\logsArchival\ArchiveDir
delete the zip files that are older than 120 days from E:\TIBCO\logsArchival\ArchiveDir
All the above steps need to be written to the logs.

Please take a look at these links, where your requirement has been addressed before:
MS Dos Batch delete old files in directory and Batch file to delete files older than N days
You can easily customize those scripts to accomplish the remaining compression of the files. Please note, that in DOS the compress command is COMPACT. Use COMPACT /H for usage information.

Related

Exporting .sql file from MSI

I have an MSI file that contains several .sql script files, can anyone tell me if it is possible to extract these file and look at the content. I tried using orca to export the ISSQLScriptFile table, but the files were exported as .sql.ibd, which is useless.
Thank you!
I haven't looked at this in a long time but as I recall it's all encrypted.
https://community.flexerasoftware.com/showthread.php?188927-Extract-packed-script-sql-from-msi
"For security, the script is encrypted and then stored in the MSI package."
Someone then mentions that you can intercept the SQL files from a temp directory while the installer is running.
MichaelU could weigh in if this is still true and if there are any other work arounds.
Assuming that the files are inside the MSI file in the sense of being in the internal CAB file, then do an "administrative" install, which is not an install at all. A typical command would be:
msiexec /a [path to msi file] TARGETDIR=[path to a folder where the files will go]
It extracts all the separate files to that location.

where is my batch file?

I made several bat files using task scheduler(custom) and I need to apply these to all of my 70 server computers. Obviously I don't want to repeat the same procedure at every server.
Can I simply copy and paste my bat files to different computers and expect same result?
If so, where are my bat files and where should I paste them?
Simply copy your batch files to different servers.
This post here shows location of task scheduler.
Folder location:
%systemroot%\System32\Tasks
Registry:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Taskcache\Tasks
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Taskcache\Tree
You may want to try the xcopy and for command to send your batch file to all servers.
Command syntax:
FOR command can loop through your server names, and XCOPY copys the batch script to the other servers.
for %%G in (serverA
serverB
serverC
...
serverZ) do xcopy [source] [destination] [options]
Note that asterisks does not work as intended, since it works as a wildcard.

Copying files from folders in root directory containing same names related to batch file

I want to know something about batch files. I am completely new to batch files writing.
I am using Hyerstudy 12.0 Software for Running Abaqus jobs. I want to run three Abaqus jobs simultaneously.
I have some files that have the same names but contain different data. I cannot change the name of these files for all 3 jobs as Hyperstudy creates 4 folders from the root directory for running jobs.
I am using in my batch file:
copy ..\..\..\..\Abaqus_job.inp Abaqus_Job.inp
I have created 3 folders in root directory for all 3 jobs that contain the files with same names. I want to copy these folders and I want to access the data from the files that these folders contain.
How can I do that with a batch file?

Windows Batch Programming

I have some files that are automatically generated by an external sources into a local machine each day.
I have batch script, which moves the data from that source folder into a destination folder.
So i would like to move the files using time and date. But the robocopy command only accepts date.
Please see the script below
robocopy \\IP\f$\EMAILMT\202 C:\IntellinxServices\Queues\SwiftGen\MT202 *.rje /MAXAGE:%NEWDATE%

How can I backup target files with xcopy?

I change my project files on live by copying only the changed files with one xcopy command. Is it possible to back-up the target files (only the changing ones) into another location with xcopy? Or with a batch script?
Sorry, my question is not clear enough, here are some further explanation:
I have files in folder A that I xcopy to folder B. But I need to backup the files in folder B that are overwritten. How can I do this the easiest way?
Thanks.
xcopy /d
from the xcopy help
/D:mm-dd-yyyy
Copy files changed on or after the specified date.
If no date is given, copy only files whose
source date/time is newer than the destination time.

Resources