Hi John,
Many Thanks for your reply. I presume you are saying that the JSch API does not provide the ability to force close connections on a file and that we need to clean up the rogue connections outside of the API e.g. directly on the server. It appears to me that an alternative is to skip the deletion attempt on the files that are found to be open. I am hoping I could use the Channel.isClosed() method for this. Any ideas please? Thanks & Regards, Ram On Wed, 09 Dec 2009 03:58:39 +0530 wrote > No SFTP cannot do that. You will need to find a way of getting the remote server to do these tasks outside of SFTP > From: Ramprasad D V [mailto:ramprasa...@rediffmail.com] >Sent: 2009, December, 09 1:31 AM >To: jsch-users@lists.sourceforge.net >Subject: [JSch-users] Can a file opened by other users be force closed > > Hello All, > >Our application posts a file each day to an SFTP server. Before doing so, it deletes the file posted on the previous day. We use the com.jcraft.jsch.ChannelSftp (jsch-0.1.40.jar). > >We have had problems with the deletion of the previous day’s file in that when a client application has the file open (when it should not) at the same time as we are trying to delete the file. This causes our file generation process to fail with the Permission Denied error. > >We would like to fix this as below before proceeding to delete the file > Force kill any connections to the file and > Close the file > >I am a newbie in this area. Please can you advise if the ChannelSftp API provides the ability to achieve the above desired behaviour and which classes/methods can be used to achieve it. > >for (Object file : files) >{ >ChannelSftp.LsEntry lsEntry = (ChannelSftp.LsEntry) file; >log.info("Deleting file " + lsEntry.getFilename()); >try >{ >ch.rm(lsEntry.getFilename()); >} >catch (SftpException e) { >} >Thanks in advance for your help. > >Regards, >Ram > > > > ____________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient(s) is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately and delete this e-mail. The contents of any attachment to this e-mail may contain software viruses or other defect which might affect your own computer system once received or opened. While companies under RBC Dexia Investor Services Trust and its affiliates take reasonable precautions to minimize that risk, we cannot accept liability or responsibility for any damage or loss which may occur or be sustained as a result of a software virus or other defect. You are responsible for virus checks before opening any attachment.
------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev
_______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users