Hi, Usually the current message should contain the CamelFileName header when catching exception. If not, before the SFTP transfer you can keep the filename in a property and reuse it afterwards.
<setBody><constant>TEST</constant></setBody> <setProperty name="fileABC"><simple>{{fileprefixABC}}_${date:now:yyyyMMdd_HHmmss}.txt</simple></setProperty> <doTry> <toD uri="sftp://{{serverABC}}:{{portNumberABC}}{{directoryABC}}?fileName=${exchangeProperty.fileABC}&username={{usernameABC}}&timeout=5000&binary=false&stepwise=true&jschLoggingLevel=ERROR&disconnect=true&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=1&privateKeyFile={{ABC.REPO}}/{{userkeyABC}}&knownHostsFile={{ABC.REPO}}/{{knownHostABC}}&proxy=#proxyout" /> <doCatch> <exception>java.net.ConnectException</exception> <exception>java.net.UnknownHostException</exception> <exception>com.jcraft.jsch.JSchException</exception> <exception>org.apache.camel.component.file.remote.SftpOperations</exception> <exception>org.apache.camel.component.file.GenericFileOperationFailedException</exception> <log message="CamelFtpReplyCode = ${header.CamelFtpReplyCode}"/> <log message="CamelFtpReplyString = ${header.CamelFtpReplyString}"/> <log message="CamelFileName = ${header.CamelFileName}" /> <log message="property fileABC = ${exchangeProperty.fileABC}" /> <stop/> </doCatch> </doTry> Hoping that can help. Daniel Langevin -----Message d'origine----- De : André kouamé <kouameandr...@gmail.com> Envoyé : 15 novembre 2022 11:14 À : users@camel.apache.org Objet : How can i retrieve file name when SftpException Occured Hi all, I want to know if it's possible to get the file name when an error occurred during a local copy file in SftpOperations. I have put an OnException but in the processor, i can't get the name of file because the message has been changed during GenericFileOperationFailedException. Best regards, André Kouamé.