BizTalk - SFTP - Overwrite Existing file - biztalk

I am trying to copy a file using SFTP .
Suppose in the destination SFTP location same file name exists, can we overwrite that with a new file?
Or can we delete the existing file in the destination and copy the new one?
We know the file name which needs to be moved to destination SFTP location.

In the SFTP adapter, the default behavior is to overwrite if it already exists. It's probably best to try it out yourself, because you will have questions about how components behave more often in BizTalk.

Related

How to download files from SFTP that doesn't have actural files in Synapse?

I have a little bit complicate situation here:
I need to download files from a SFTP daily. I connect to the SFTP with username and SSH key, the keys have a passphrase.
This SFTP has no actual files. All the files on the server is 0 bytes. The server will dynamicly generate the file if it get a "get" command.
So when I connect the SFTP with Winscp, everything went perfectly.
But I have to do it in Synapse.
I managed to connect it in Pipeline with copy activity, and I managed to download all the files, but with no data content inside.
Does anyone know how I can download the files with content?
If you actually have files with content in SFTP location, then they should also be automatically copied using the pipeline in your Synapse. In case if you just want to copy the files that are having the content and ignore empty files, then you will have to use a get metadata activity to check the size of the file (i.e., > 0 bytes) and then filter those files only to copy to your desired destination. Using the childItems you can get the fileName, Type and Size and use these properties in the subsequent copy activity to only copy filter files to your destination.

vagrant/puphpet: adding a custom nginx default conf file

i use Puphpet to create a local testing vagrant /VM servers and my question is:
I ssh into the VM to change my etc/nginx/conf.d/default.conf config file, but every now and then when either i have to to or choose to i destroy the said vm to mainly re-create or because of issue, i need to repeat the above process of having to update a few config files.
Is there a way say within the vagrantfile or the comman.yaml (puphpet) file to actually add this automatically so i don't need to do this at all.
You could create a shell script in puphpet/files/exec-once[1] to replace your default.conf file.

Creating a new file without using a ServletContext

Assume I want to write to a new file created within the space of my webapp.
One way would be use getServletContext().getRealPath("/") and use that String to create a new file on the server. However, often I come across advice like not using getServletContext().getRealPath("/").
Can someone please let me know of another way to write a new file within my webapp?
Many thanks.
Have some configuration property containing the absolute path of a directory outside of the webapp and web server path, read this path from the configuration property, and write to this directory.
To serve files from this directory, write a servlet that takes the name or ID of this file as parameter, reads the file from the directory, and sends its content to the response.
This will
work even if the app is deployed as a war file and never unzipped to the file system
allow you to redeploy the next version of the app or server without deleting all the uploaded/created files
allow you to add whatever control you want on the uploaded/created files, instead of making them available to everyone
In short, treat these files as data, stored in a database which happens to be the file system instead of a SQL database.

Drupal: change path to uploaded files

I copied a site files to test host for further developement.
And I want uploaded files to be loaded from old host.
For example, files a re stored in drupal_folder/sites/default/files/ (example.com/sites/default/files).
I need this files to be accessible from other site (example.dev.com)
I mean I want to change path to all files on a new host (example.dev.com).
I tried to change path to all files in database with command
UPDATE `files` SET `filepath` = REPLACE(`filepath`, "sites/default/files/", "http://example.dev.com/sites/default/files/");
but URLs are like example.dev.com/http://example.dev.com/sites/default/files/ after this.
I hope it makes sence.
How can I do it?
Use ln to create the link to that directory if you are using linux.
http://linux.about.com/od/commands/l/blcmdl1_ln.htm

Reading/writing a text file in a servlet, where should this file be stored in JBoss?

I have servlet deployed in JBoss. I want to read/write data into a text file based on the client input. Where should this text file be put in the JBoss directory structure?
There the /data directory is for.
Its absolute path is available by the jboss.server.data.dir system property.
File dataDir = new File(System.getProperty("jboss.server.data.dir"));
File yourFile = new File(dataDir, "filename.ext");
// ...
See also:
JBoss Wiki - JBoss Properties
Note that you're this way tight-coupling the web application code to a specific server. If you ever want to change servers, keep in mind to change the above code as well to whatever the new server supports (or not).

Resources