I have a war file and I want to convert it to original file, is it any way to convert war file into original file through command prompt
You have 2 options :
1. use "jar xvf myfolder.war" to extract the files
2. Use WinZip to open the war file and then extract the files that you need.
You can use jar -xvf warfilename.war.
Related
I have an ETL (SSIS) job which creates a file in a folder named as TEST_20170505.csv before it sends the file to an SFTP server.
There would be multiple file in the folder such as, TEST_20170504.csv, TEST_20170503.csv. Currently I am using following sftp script file (File.txt) in a batch file.
lcd E:\localpath\
cd \sftpserverpath\
ascii
put *.csv
bye
This is my .bat file.
sftp -oIdentityFile=E:\sftp\filepath\ssh.ppk -B E:\sftp\filepath\File.txt username#ipaddress
But this will upload all the files in the local path to SFTP server instead of taking the latest/last modified/current date file.
OpenSSH sftp cannot do this on its own. But you can use some fancy batch file construct to select the latest file and then generate an ad-hoc sftp upload script.
Some references:
How do I write a Windows batch script to copy the newest file from a directory?
Windows batch file - Upload only latest file to FTP
Or use some more advanced Windows command-line SFTP client.
For example with WinSCP scripting, it's as easy as using -latest switch in the put command:
open sftp://username#example.com/ -privatekey=ssh.ppk
lcd E:\localpath\
cd \sftpserverpath\
ascii
put -transfer=ascii -latest *.csv
exit
Run the script (upload.txt) like:
winscp.com /script=upload.txt /ini=nul /log=upload.log
You can even have WinSCP generate the script/batch file for you (you just need to add the -latest switch manually).
References:
Uploading the most recent file with WinSCP
Converting OpenSSH SFTP script to WinSCP script
Note that WinSCP uses .ppk format of private key files. While OpenSSH sftp uses PEM format. Even though your key file is named .ppk, it cannot be real .ppk file, otherwise the sftp would reject it. You have probably converted original .ppk file to PEM, but incorrectly kept an original extension. You have to use the original .ppk file with WinSCP (if you do not have it, you can convert the PEM back to .ppk using PuTTYgen).
Also note that WinSCP actually supports the text/ascii mode (-transfer=ascii), while sftp does not (there's no ascii command).
(I'm the author of WinSCP)
The solution is instead of "put *.csv" in your script file, you specify the actual filename you want to upload
I want to download files using ssh commands, there's a text file containing all urls of files I want to download, The problem is that I want these files to be downloaded each one in their respective folder.
For example, Here is some sample links in that txt file:
http://dl.example.com/2016/06/file1.zip
http://dl.example.com/2016/06/softwares/file2.zip
http://dl.example.com/2013/09/anotherfile.mp3
http://dl.example.com/movies/samplemovie.mkv
I want these files to be downloaded in this schema :
root/2016/06/file1.zip
root/2016/06/softwares/file2.zip
root/2013/09/anotherfile.mp3
root/movies/samplemovie.mkv
I mean I want this command to not only download the file, But also create the directory of that file exactly on my server.
How can I do that ?
I want to be able to zip up a couple WLAN.xml files and a batch file.
Batch file will contain the commands to import those WLAN.xml's.
Can this be done directly from the zip file? Or is there a command to copy them from the zip file to a specific location (ie. c:)?
I currently have the WLAN.xml files in C:\ and my batch files specifies the location of it.
NOTE: To do this you would have to download the tool 72a.exe from 7zip, Although most computers nowadays already have it pre-installed
You can just use the following syntax:
7z a -tzip archive.zip -r src*.cpp src*.h
Apply your respective file path to the syntax above, and it should work.
Basically I am facing issue in extracting the jar.I tried using the following command to extract jar file:-
jar xvf myjar.jar META-INF/MANIFEST
But java path is not set for that system.i.e. jdk is not added to the path environment variable.So jar xvf command cannot run.
Is there any other way to extract the jar file or accessing the manifest file without extracting the jar?
This question is a duplicate of How to unzip a file using the command line? which I found using the search string stack overflow unzip jar dos
I'm using a PSFTP script to upload files to a remote server for processing and there are specific steps that I need to take with file in order for the file to be processed correctly by their system. Specifically, I have to upload the file with a ".u01" in the extension, then rename it to a ".r01". after it has been uploaded.
Is there a way to replace just the extension of the uploaded file? The rest of the filename can't be modified because the filename is corresponds with the contents of the file.
And no, I can't just upload it with a ".r" extension. Tried that already :P
The script is simple. It uploads all files from the "to_upload" directory into "ul" on the remote server:
cd ul
put -r to_upload/