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
------------------------------------------------------------------------------ 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