¿Cómo detener el acceso a un archivo no válido en el servidor SFTP?

My client has configured a SFTP server and monitoring the folder using FileWatcher. As soon s as the file are copied to SFTP server, client picks them.

If the connection is broke down while transferring the file, client picks the invalid file.

In between, I go for deleting the invalid file, client has already picked and delete that file from that folder.

How I can stop access for client to that file until I finish the full transaction.

preguntado el 03 de mayo de 12 a las 08:05

2 Respuestas

There exist two generic options - upload the file to different folder and move it (you have denied this for your particular case) and upload the file with different name and rename the file once upload is complete.

If you control the server's architecture, you can do the following trick: upload the file with the name of filename..ext . The server will check the file name and know expected size. Once the file is of specified size, it can be picked and renamed by the server.

contestado el 03 de mayo de 12 a las 09:05

I have no control at client side. The architecture is fix and the client will not make any changes. - Romil Kumar jainista

@Romil then you're out of luck - once the transfer is interrupted, from server's point of view file upload is complete. Point. - Devolución de llamada de Eugene Mayevski

@Romil, Did you found a solution? can you share the approach that worked well? - Usama Jalil

You should use a temporary folder for upload, and move the files in the monitored folder only when the file is completely upload.

contestado el 03 de mayo de 12 a las 08:05

The SFTP folder architecture is designed by client, we cann't modify it. - Romil Kumar jainista

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.