I have a folder on my D drive (D://MyFolder), which I want to compress into a .WAR file (D://MyFolder.war).
I am trying to automate a deployment process using PowerShell, so I am looking for a PowerShell (or MS command line) command to do this.
I've tried to google and scourge StackOverflow, but haven't been able to find anything yet. This is my first 'PowerShell Adventure', so I'm not entirely sure if/how I can do this?
Many thanks for your help.
What about simple (if you do not have JAVA_HOME which you can check with env | sls JAVA_HOME):
cd D:\MyFolder
& "<path_to_your_java>\bin\java.exe" -cvf my_folder.war *
java options:
-c create new archive
-v generate verbose output on standard output
-f specify archive file name
Related
I am attempting to write a command that calls 7-zip from the command line. My command is:
7z x z:\dev\archive.7z
Anytime I run this command in the command prompt, it acts like it's working, but when I navigate to the folder after the fact, the extracted files aren't there, although they are there if I run 7-zip from the contextual menu. Is there something I'm missing here?
If you don't specify a destination directory, 7z will extract files in your current directory.
As per the doc, to specify a target:
7z x archive.zip -oC:\path\to\target
Or use cd C:\path\to\target and then invoke your initial command.
In your case (from comments), what you want is:
7z x z:\dev\archive.7z -oz:\dev
This nice answer might help if you're confused with the options.
Try using the -spf switch
7z x z:\dev\archive.7z -spf
I have backup files in different directories in one drive. Files in those directories can be quite big up to 800GB or so. So I have a batch file with a set of scripts which upload/syncs files to S3.
See example below:
aws s3 sync R:\DB_Backups3\System s3://usa-daily/System/ --exclude "*" --include "*/*/Diff/*"
The upload time can vary but so far so good.
My question is, how do I edit the script or create a new one which checks in the s3 bucket that the files have been uploaded and ONLY if they have been uploaded then deleted them from the local drive, if not leave them on the drive?
(Ideally it would check each file)
I'm not familiar with aws s3, or aws cli command that can do that? Please let me know if I made myself clear or if you need more details.
Any help will be very appreciated.
Best would be to use mv with --recursive parameter for multiple files
When passed with the parameter --recursive, the following mv command recursively moves all files under a specified directory to a specified bucket and prefix while excluding some files by using an --exclude parameter. In this example, the directory myDir has the files test1.txt and test2.jpg:
aws s3 mv myDir s3://mybucket/ --recursive --exclude "*.jpg"
Output:
move: myDir/test1.txt to s3://mybucket2/test1.txt
Hope this helps.
As the answer by #ketan shows, Amazon aws client cannot do batch move.
You can use WinSCP put -delete command instead:
winscp.com /log=S3.log /ini=nul /command ^
"open s3://S3KEY:S3SECRET#s3.amazonaws.com/" ^
"put -delete C:\local\path\* /bucket/" ^
"exit"
You need to URL-encode special characters in the credentials. WinSCP GUI can generate an S3 script template, like the one above, for you.
Alternatively, since WinSCP 5.19, you can use -username and -password switches, which do not need any encoding:
"open s3://s3.amazonaws.com/ -username=S3KEY -password=S3SECRET" ^
(I'm the author of WinSCP)
I am using Pentaho CE 5 on windows. I would like to use CTools but I can't make them show up in the File -> New menu to use them.
Being behind a proxy, I can not use the Marketplace plugin, so I have tried a manual installation.
First, I tried to use the ctools-installer.sh. I have run the following command line in cygwin (wget and unzip are installed):
./ctools-installer.sh -s /cygdrive/d/Users/[user]/Mes\ Programmes/pentaho/biserver-ce/pentaho-solutions/ -w /cygdrive/d/Users/[user]/Mes\ programmes/pentaho/biserver-ce/tomcat/webapps/pentaho/
The script starts, asks me what module I want to install, and begins the downloads.
For each module, I get an output like (set -x added to the script) :
echo -n 'Downloading CDF...' Downloading CDF...+ wget -q --no-check-certificate 'http://ci.analytical-labs.com/job/Webdetails-CDF-5-Release/lastSuccessfulBuild/artifact/bi-platform-v2-plugin/dist/zip/dist.zip'
-O .tmp/cdf/dist.zip SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
'[' '!' -z '' ']'
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cdf/dist.zip -d .tmp End-of-central-directory signature not found. Either this file is not a zipfile, or it
constitutes one disk of a multi-part archive. In the latter case
the central directory and zipfile comment will be found on the last
disk(s) of this archive. unzip: cannot find zipfile directory in
.tmp/cdf/dist.zip,
and cannot find .tmp/cdf/dist.zip.zip, period.
chmod -R u+rwx .tmp
echo Done Done
Then the script ends. I have seen on this page (pentaho-bi-suite) that it is the normal output. Nevertheless, it seems a bit strange to me and when I start my pentaho server (login: admin/password), I cannot see any new tools in the menus.
After a look to a few other tutorials and the script itself, I have downloaded the .zip snapshots for every tool and unzipped them in the system directory of my pentaho server. Same result.
I would like to make the .sh works, what can I try or adjust ?
Thanks
EDIT 05/06/2014
I checked the dist.zip files dowloaded by the script and they are all empty. It seems that wget cannot fetch the zip files, and therefore the installation fails.
When I try to get any webpage through wget, it fails. I think it is because of the proxy.
Here is my .wgetrc file, located in my user's cygwin home folder:
use_proxy=on
http_proxy=http://[url]:[port]
https_proxy=http://[url]:[port]
proxy_user=[user]
proxy_password=[password]
How could I make this work?
EDIT 10/06/2014
In the end, I have changed my network connection settings to bypass the proxy. It seems that there is an offline mode for the installer, so one can download all needed files on a proxy-free environment and then run the script offline.
I guess this is related with the -r option.
I consider this post solved, since it not a CTools issue anymore.
Difficult to identify the issue in the above procedure..
but you can refer this blog he is key member of pentaho itself..
In the end, I have changed my network connection settings to bypass the proxy. It seems that there is an offline mode for the installer, so one can download all needed files on a proxy-free environment and then run the script offline. I guess this is related with the -r option.
I consider this post solved, since it is not a CTools issue anymore.
You can manually install the components from http://www.webdetails.pt/ctools/ or if you have pentaho 5.1 or above, you add the following parameters to CATALINA_OPTS option (in start-pentaho.bat or start-pentaho.sh):
-Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttp.nonProxyHosts="localhost|127.0.0.1|10...*"
http://docs.treasuredata.com/articles/pentaho-dataintegration#tips-how-can-i-use-pentaho-through-a-proxy
The Ruby Devkit is a 7-zip based self-extracting archive.
I would like to invoke it silently without having to install 7-Zip to extract the files to a folder of my choosing, so that I can script the installation. I imagine it to be something like:
cmd> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe /silent /dir="C:\DevKit"
But that, of course, doesn't work. What command line flags must I use to silently extract this archive into a folder of my choice?
try this:
C:\> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe -o"C:\DevKit" -y
Update 2017: The tool from 7zsfx.info is now dead and gone.
Original, old post from 08-2015:
If you are trying to extract an 7zip SFX (http://7zsfx.info/) archive:
sfx.exe -y -gm2 -InstallPath="C:\\your\\target\\path"
Switches Docu
-y hide some prompts
-gm2 hides the extraction dialog completely (silent mode)
-InstallPath sets the target path (you need double backslashes)
7z SFX Guide
The official way to create a SFX package is to use -sfx[{name}] : Create SFX archive.
And that means the created SFX packages uses two kinds of CLI options:
official CLI options from 7zSFX, and
the passed through options you configured in your config, before creating the package.
You can think of it as parameter forwarding to the packaged executable. This parameter forwarding depends on the SetEnvironment and RunProgramm configuration!
The full process:
Create archive Package.7z:
containing Installer.msi and additional crap.cab file.
Create config file config.txt:
;!#Install#!UTF-8!
Title="Installation"
SetEnvironment="strInstall=hidcon:Installer.msi /qn"
RunProgram="%strInstall%"
;!#InstallEnd#!
Now we generate Test.exe by combining sfx+config+archive into an executable.
copy /b 7zS.sfx + config.txt + Package.7z SfxInstaller.exe
Note: 7zS.sfx is from the official 7zip extra package.
Now, when you run SfxInstaller.exe you can pass for instance /lv InstallerLog.txt to create a install log, e.g.
SfxInstaller.exe /lv InstallerLog.txt
Since 7-zip is used, simply create a self-extracting archive in .exe. and run it with switches -o and -y.
I use it to save space on USB drive. For instance, I run VDiskAir application infrequently. I create a self-extracting archive of the VDiskAir program folder (about 15MB):
7z a -SFX -mx9 VDiskAir.exe [VDiskAir folder path]
NB: -mx9 is used here to maximise compression.
I create a DOS BAT to run the self-extracting VDiskAir.exe (about 5MB) created, save it as VDiskAir.bat containing:
VDiskAir.exe -o%TMP% -y
%TMP%\VDiskAir\VDisk_Air.exe
I'm not worried that the VDiskAir folder (in %TMP% extracted with VDiskAir program files) is undeleted after running VDiskAir this way, since I have a BAT script to clear %TMP% on shutting down/starting up.
Below is what I use for Autodesk product:
Start /W %~dp0AutoCAD_2018_French_LP_Win_64bit_dlm.sfx.exe -suppresslaunch -d C:\Autodesk
I'm trying to automate the install of my platform. I've made a script for compressing the build of the deployables to a 7zip file.
Now i need to uncompress partially some folders to a specific destination.
Package
-app1
--folder11
---folder111
--folder12
-app2
--folder21
--folder22
...
I need to create a powershell script to extract the content of 'app1' to a destination folder.
I've been trying to use the following command but the result is not the as i expected.
I've been receiving the full path and not the content from folder11 recursivelly.
Set-Alias zip $ZipCommand
zip x $FilePath app1\folder11 -oc:DeployableFolder -r
Any ideas? Suggestions?
Thanks.
I tried and had no issue.
set-alias zip "c:\Program Files\outils\7-Zip\7z.exe"
zip x program.7z python-core-2.6.1\lib -oc:\data
I eventually got a c:\data\python-core-2.6.1 which only contains the lib folder with all its subfolders & files.
The only difference I see is the backslash \ in the output path.
HTH