Extract ZIP file in specific folder on server using terminal? - server

I have a problem with my VPS server, more precisely with extracting a .zip file (5GB) through the file manager. I have limited support because it is a self-managed VPS. I need a command for a terminal to extract file "5.zip" to a specific server dir for ex: http:xxxxxxx.com/funny folder on my server. Can someone help me with this? Thanks.

You provide URL, not path to directory. But to extract zip file in particular directory you can use command:
cd /directory/funny
unzip /path/to/5.zip
Change /directory/funny with the real directory which your web service serve.

Related

Where to keep the resources.xml file for Rundeck CLI

I am using Rundeck CLI. Where should I keep the resource.xml file so that it is available for the given project? Is there any specific location the file needs to be or it can be in any folder and one just point out to the location?
No specific place is needed for the resources.xml/resources.yaml files (also, you can use any name for that file btw, for example: project_test.xml). You can use any location reachable by the rundeck user (RPM/DEB-based installations) or reachable by the user that launches Rundeck (WAR-based installation). A good place to store these files could be the /var/lib/rundeck/ path.

Count files in a ZIP file over SFTP using PowerShell

I am connecting to SFTP via host, port, username and password using PowerShell. I want to count the number of files in a particular zip folder without having to download the zip folder on my local machine and count. Please share the piece of logic that would do this. I looked into this but it seems a bit tricky when it comes to do this in a zip folder.
That's not an easy task to do. There's no API in SFTP to do that completely remotely. There are basically two solutions:
Use SFTP to download only the ZIP central directory (basically the listing that is placed at the very end of the ZIP file). And decode the directory locally. For C#, this is covered in my answer to List files inside ZIP file located on SFTP server in C#. Though as mentioned there, there's a bug in SSH.NET that requires a workaround with implementing an interface. While that's probably doable in PowerShell too, I've never done that.
If you have an SSH shell access to the server, use remote zip command to list the contents of the file. Or build another API (like a web service).
Btw, note that there's nothing like ZIP "folder". ZIP is an archive file. It's only Windows that call ZIP files "folders".

Copy files from SFTP with CMD

We have a customer with their SFTP site, and I would like to copy files from specific folder, by using any automated process.
One of the example which I found, is winscp.net, but I have not managed how to use it, for my purpose.
http://www.itworld.com/article/2928599/windows/how-to-automate-sftp-file-transfers-in-microsoft-windows.html
QUESTION: All I will need is not run script and the file should be copied from their directory to my local folder. Is it possible at all?
I found the way of using PSFTP(Putty) to connect to the server, but how to make it automatically, do not know.
I think its a good solution for your problem.
You have to install winscp and the code some files and it will do automaticaly. I used 3 or 4 times. Also you need the key for your SFTP to connect throught it.
Here a link to the guide step by step.
https://winscp.net/eng/docs/guides
Here is a link to the scripting webpage
https://winscp.net/eng/docs/scripting
I recommend you to create an ini file to load all of the characteristics of your ftp connection and then execute an script over this.
It can be launched like that
WinSCP.com /ini=[your ini file] /script=[Your script file(what you want to do when it is connect)]
Hope this helps!.

Mule Server - application code to be deployed in standalone folder

Our Mule 3 server is installed at "/mule/instance0/" on our UNIX server and the application is deployed under "/mule/instance0/apps/" folder. We have been deploying a zip file into the "/mule/instance0/apps/" folder and application runs fine.
There is a new requirement to deploy the application zip file in a folder other than "/mule/instance0/apps" folder (say "/tmp"). We tried looking for the changes that need to be made and they were rather humongous. Does anybody know of a simple config change to pick the application code from a folder other than "/mule/instance0/apps" ?
Thanks,
Midhun
You can make apps directory a symbolic link to tmp: $cd $MULE_HOME; rm -rf apps; ln -s /tmp apps

How do i FTP upload directory in Powershell

I came across this post:
Upload files with FTP using PowerShell
But I'm looking how i can upload a directory with files in it to a FTP server.
Thanks in Advance
You should write a script that loop into directory and then upload files one by one. I don't remember that ftp command on windows can upload an entire directory.
You should find example here :
http://www.dostips.com/DtTipsFtpBatchScript.php