ComposantsComponents › Internet › FTPInternet › FTP
Télécharge des fichiers d'un serveur FTP, FTPS (FTP sur TLS) ou SFTP (transfert par SSH) vers un dossier local. Les fichiers sont choisis par des masques ; le masque "*" descend dans les sous-dossiers et les recrée en local. Un fichier local déjà présent est gardé, remplacé ou complété selon le réglage. Le composant ouvre sa propre connexion, ou reprend celle d'un tFTPConnection. Pour envoyer des fichiers, prenez un tFTPPut.
Downloads files from an FTP, FTPS (FTP over TLS) or SFTP (transfer over SSH) server to a local folder. The files are chosen with masks; the "*" mask goes down into the subfolders and creates them again locally. A local file already there is kept, replaced or extended depending on the setting. The component opens its own connection, or takes over the one of a tFTPConnection. To upload files, take a tFTPPut.
EntréeInput
Aucune : il commence un sous-job. Sinon Iterate (un téléchargement par itération) ; un lien Main est accepté mais ne fonctionne pas (voir Les liens). None: it starts a subjob. Otherwise Iterate (one download per iteration); a Main link is accepted but does not work (see Links).
SortieOutput
Un lien Main ou Iterate : une ligne, ou une itération, par ligne de Fichiers, sans colonne. One Main or Iterate link: one row, or one iteration, per row of Files, without columns.
Déclencheurs en sortieOutput triggers
On Subjob Ok On Subjob Error On Component Ok On Component Error Run if
Le tFTPGet dépose les fichiers dans un dossier local ; un tFileList les parcourt ensuite et un tFileInputDelimited les lit. Un fichier distant absent n'est pas une erreur : testez NB_FILE si vous en attendez un (Run if).
The tFTPGet drops the files in a local folder; a tFileList then goes through them and a tFileInputDelimited reads them. A missing remote file is not an error: test NB_FILE if you expect one (Run if).
Télécharger, puis supprimer les fichiers du serveur (tFTPDelete) ou les ranger ailleurs (tFTPRename) : le tFTPGet n'a pas d'option pour déplacer ou supprimer après le transfert. Utiliser une connexion existante coché, attention au répertoire courant qu'il laisse (voir l'exemple). Download, then delete the files from the server (tFTPDelete) or move them elsewhere (tFTPRename): the tFTPGet has no option to move or delete after the transfer. Use an existing connection checked, mind the current directory it leaves (see the example).
"/in"), puis une ligne par masque dans Fichiers.
Give the Local directory (absolute path, created when missing) and the Remote directory as an absolute path ("/in"), then one row per mask in Files.
Sans connexion existante, le composant a les réglages de connexion du tFTPConnection, avec les mêmes défauts et le même code généré ; ils sont décrits sur sa page. Ils sont masqués quand Utiliser une connexion existante est coché. Without an existing connection, the component has the connection settings of the tFTPConnection, with the same defaults and the same generated code; they are described on its page. They are hidden when Use an existing connection is checked.
PROPERTY) : Built-in ou une connexion FTP du Référentiel.Property Type (PROPERTY): Built-in or an FTP connection of the Repository.USE_EXISTING_CONNECTION, non) et Liste des composants (CONNECTION) : un tFTPConnection du job.Use an existing connection (USE_EXISTING_CONNECTION, no) and Component list (CONNECTION): a tFTPConnection of the job.HOST, "localhost"), Port (PORT, 21 ; FTPS_PORT, 990 en FTPS), Utilisateur (USERNAME, "anonymous"), Mot de passe (PASSWORD, "suomynona").Host (HOST, "localhost"), Port (PORT, 21; FTPS_PORT, 990 with FTPS), Username (USERNAME, "anonymous"), Password (PASSWORD, "suomynona").SFTP) ou Support de FTPS (FTPS), l'un excluant l'autre ; ni l'un ni l'autre : FTP.SFTP Support (SFTP) or FTPS Support (FTPS), each excluding the other; neither: FTP."ISO-8859-15").SFTP: Authentication method, Private key, Key Passphrase, Filename encoding. FTPS: Keystore File, Keystore Password, Security Mode (Implicit by default). FTP and FTPS: Connection Mode (Passive), Encoding ("ISO-8859-15").
Deux différences avec le tFTPConnection : l'utilisateur et le mot de passe s'appellent ici USERNAME et PASSWORD (USER et PASS là-bas, défaut ""), et le composant a en plus Ignorer les erreurs à la fermeture (FTP), décrit plus bas.
Two differences with the tFTPConnection: the user and the password are named USERNAME and PASSWORD here (USER and PASS there, default ""), and the component also has Ignore Failure At Quit (FTP), described below.
Les réglages du transfert, dans l'ordre de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. « FTP », « FTPS », « SFTP » désignent le protocole du composant, ou celui du tFTPConnection choisi. The transfer settings, in the order of the Component tab; the technical name, in grey, is the parameter name in the job file. "FTP", "FTPS", "SFTP" mean the protocol of the component, or the one of the chosen tFTPConnection.
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| Répertoire localLocal directoryLOCALDIR | "." |
ToujoursAlways |
Dossier de la machine du job où sont écrits les fichiers. Il est créé, parents compris, s'il manque, une fois la connexion ouverte et le répertoire distant trouvé. "." est le dossier de travail du processus du job : écrivez un chemin absolu.
Folder of the job machine where the files are written. It is created, parents included, when missing, once the connection is open and the remote directory found. "." is the working folder of the job process: write an absolute path.
|
| Répertoire distantRemote directoryREMOTEDIR | "." |
ToujoursAlways |
Dossier du serveur où sont cherchés les fichiers. "." : le dossier courant de la connexion, en général le dossier de connexion du compte. Un dossier absent arrête le job, même Arrêter en cas d'erreur décoché (voir Erreurs). Préférez un chemin absolu, autre que "/" (voir Pièges).
Folder of the server where the files are looked for. ".": the current folder of the connection, usually the login folder of the account. A missing folder stops the job, even with Die on error unchecked (see Errors). Prefer an absolute path, other than "/" (see Pitfalls).
|
| Déplacer vers le répertoire courantMove to the current directoryMOVE_TO_THE_CURRENT_DIRECTORY | OuiYes | Connexion existante, pas en SFTPExisting connection, not SFTP | Cochée : après le composant, la connexion partagée reste dans le Répertoire distant. Décochée : elle revient au dossier où elle était avant (voir l'exemple). En SFTP, le composant repart toujours du dossier de connexion du compte. Checked: after the component, the shared connection stays in the Remote directory. Unchecked: it goes back to the folder it was in before (see the example). With SFTP, the component always starts again from the login folder of the account. |
| Mode de transfertTransfer modeMODE | ASCIIascii | FTP |
ASCII (TYPE A) ou Binaire (TYPE I). En FTPS, le réglage est masqué et le transfert est toujours binaire. Voir Le mode de transfert.
ascii (TYPE A) or binary (TYPE I). With FTPS, the setting is hidden and the transfer is always binary. See The transfer mode.
|
| Écraser le fichierOverwrite fileOVERWRITE | Jamaisnever | FTP, Écrire à la suite de décochéFTP, Append unchecked | Jamais, Toujours ou taille différente, pour le fichier local. Voir Fichier déjà présent. never, always or size different, for the local file. See File already there. |
| Écrire à la suite deAppendAPPEND | NonNo | FTP | Le contenu téléchargé est ajouté à la fin du fichier local, créé s'il manque. Écraser le fichier est alors masqué et ignoré. The downloaded content is added at the end of the local file, created when missing. Overwrite file is then hidden and ignored. |
| Écraser le fichierOverwrite fileSFTPOVERWRITE | Écraseroverwrite | SFTP | Écraser, Reprendre ou Écrire à la suite de. Voir Fichier déjà présent. overwrite, resume or append. See File already there. |
| Utiliser des Expressions Regex Perl5 en tant que masque de fichier (décocher signifie utiliser les Expressions globales)Use Perl5 Regex Expressions as Filemask (Unchecked means Glob Expressions)PERL5_REGEX | NonNo | ToujoursAlways |
Décochée : masques glob (*, ?, [ab]). Cochée : expressions régulières Java. Voir Les masques.
Unchecked: glob masks (*, ?, [ab]). Checked: Java regular expressions. See The masks.
|
| FichiersFilesFILES · FILEMASK | videempty | ToujoursAlways | Une ligne par Masque de fichier, expression Java entre guillemets. Les lignes sont traitées dans l'ordre. Sans ligne, rien n'est téléchargé, sans erreur. Il n'y a pas de colonne Nouveau nom : les fichiers gardent leur nom distant. One row per Filemask, a Java expression in quotes. The rows are handled in order. Without a row, nothing is downloaded, without an error. There is no New name column: the files keep their remote name. |
| Arrêter en cas d'erreurDie on errorDIE_ON_ERROR | OuiYes | ToujoursAlways |
Cochée : une erreur pendant le traitement d'une ligne de Fichiers arrête le composant par une exception. Décochée : son message est écrit sur la sortie d'erreur, rangé dans ERROR_MESSAGE, et la ligne suivante est traitée. La connexion, le mot de passe et le Répertoire distant sont vérifiés avant : ils arrêtent le job dans les deux cas. Aucun fichier trouvé n'est jamais une erreur.
Checked: an error while a row of Files is handled stops the component with an exception. Unchecked: its message is written to the error output, stored in ERROR_MESSAGE, and the next row is handled. The connection, the password and the Remote directory are checked before: they stop the job in both cases. No file found is never an error.
|
Les réglages de connexion de cet onglet sont ceux du tFTPConnection (voir La connexion). En plus : The connection settings of this tab are those of the tFTPConnection (see The connection). In addition:
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| Ignorer les erreurs à la fermeture (FTP)Ignore Failure At Quit (FTP)IGNORE_FAILURE_AT_QUIT | NonNo | FTP |
Une erreur d'entrée-sortie pendant la déconnexion (QUIT), une fois les fichiers téléchargés, est rangée dans ERROR_MESSAGE au lieu d'arrêter le job. Sans effet avec une connexion existante, que le composant ne ferme pas.
An input-output error during the disconnection (QUIT), once the files are downloaded, is stored in ERROR_MESSAGE instead of stopping the job. No effect with an existing connection, which the component does not close.
|
| Afficher le messagePrint messagePRINT_MESSAGE | NonNo | FTP et SFTPFTP and SFTP |
Écrit dans la console, au fil du téléchargement, file [a.csv] downloaded successfully. pour chaque fichier reçu. Les fichiers écartés ou en échec ne sont pas affichés.
Writes to the console, as the download goes, file [a.csv] downloaded successfully. for each file received. Skipped or failed files are not printed.
|
Chaque ligne de Fichiers liste le dossier distant (NLST en FTP, ls en SFTP) et télécharge les noms qui correspondent au masque. Le dossier distant de /in de nos essais contient a.csv, b.csv, notes.txt, sub/c.csv et sub/deeper/d.txt.
Each row of Files lists the remote folder (NLST with FTP, ls with SFTP) and downloads the names that match the mask. The /in remote folder of our runs holds a.csv, b.csv, notes.txt, sub/c.csv and sub/deeper/d.txt.
Le masque est traduit en expression régulière par la bibliothèque Apache ORO : * (n'importe quelle suite), ? (un caractère), [ab] (un caractère de la liste) ; les autres caractères gardent leur sens propre. Le nom entier doit correspondre, casse comprise.
The mask is translated into a regular expression by the Apache ORO library: * (any sequence), ? (one character), [ab] (one character of the list); the other characters keep their own meaning. The whole name must match, case included.
"*.csv", "?.csv", "[ab].csv" : a.csv, b.csv ; pas A.CSV."*.csv", "?.csv", "[ab].csv": a.csv, b.csv; not A.CSV."report(1).csv" : report(1).csv."report(1).csv": report(1).csv."*.*" : les fichiers du dossier dont le nom contient un point, sans les sous-dossiers."*.*": the files of the folder whose name contains a dot, without the subfolders.
Expression régulière Java (et non Perl 5, malgré le libellé), qui doit couvrir tout le nom, casse comprise. Doublez les \ dans la chaîne Java :
Java regular expression (not Perl 5, despite the label), which must cover the whole name, case included. Double the \ in the Java string:
"[ab]\\.csv|notes\\..*"
a téléchargé a.csv, b.csv et notes.txt. L'expression ".*" seule a le même effet que le glob "*" ci-dessous.
downloaded a.csv, b.csv and notes.txt. The ".*" expression alone has the same effect as the "*" glob below.
"*" : tout, sous-dossiers compris"*": everything, subfolders included
Le masque "*", et lui seul, parcourt l'arborescence : chaque sous-dossier distant est recréé dans le Répertoire local et rempli. Le tJava des exemples :
The "*" mask, and it alone, walks through the tree: each remote subfolder is created again in the Local directory and filled. The tJava of the examples:
NB_FILE = 5 CURRENT_STATUS = File transfer OK. TRANSFER_MESSAGES = [file [a.csv] downloaded successfully. file [b.csv] downloaded successfully. file [notes.txt] downloaded successfully. file [c.csv] downloaded successfully. file [d.txt] downloaded successfully. 5 files have been downloaded. ] ERROR_MESSAGE = null local: a.csv (14 bytes) local: b.csv (16 bytes) local: notes.txt (8 bytes) local: sub/c.csv (16 bytes) local: sub/deeper/d.txt (5 bytes)
Même résultat en FTPS et en SFTP. En FTP, chaque dossier est listé deux fois (LIST, pour distinguer fichiers et dossiers, puis NLST). D'après le code, les liens symboliques sont ignorés.
Same result with FTPS and SFTP. With FTP, each folder is listed twice (LIST, to tell files from folders, then NLST). According to the code, symbolic links are ignored.
Ce qui précède le dernier / (ou \, case décochée) est un dossier relatif au Répertoire distant : "sub/*.csv" télécharge sub/c.csv, à plat, dans le Répertoire local (c.csv). Seul "*" recrée les dossiers. Le composant revient ensuite au Répertoire distant avant la ligne suivante, sauf dans un cas (voir Pièges). Un sous-dossier absent n'est pas signalé en FTP (voir Erreurs).
What comes before the last / (or \, box unchecked) is a folder relative to the Remote directory: "sub/*.csv" downloads sub/c.csv, flat, into the Local directory (c.csv). Only "*" creates the folders again. The component then goes back to the Remote directory before the next row, except in one case (see Pitfalls). A missing subfolder is not reported with FTP (see Errors).
Ce que devient un fichier local de même nom, lors de nos essais (fichier local de 15 octets, fichier distant de 14). What becomes of a local file of the same name, in our runs (local file of 15 bytes, remote file of 14).
| ChoixChoice | Fichier local déjà làLocal file already there | VariablesVariables |
|---|---|---|
| Jamais (FTP, défaut)never (FTP, default) | Gardé ; le fichier distant n'est pas demandé (pas de RETR).Kept; the remote file is not requested (no RETR). |
Pas compté dans NB_FILE ; file [a.csv] exit transmission. dans TRANSFER_MESSAGES (exemple).Not counted in NB_FILE; file [a.csv] exit transmission. in TRANSFER_MESSAGES (example). |
| Toujours (FTP)always (FTP) | Remplacé.Replaced. | Compté.Counted. |
| taille différente (FTP)size different (FTP) | Taille distante lue (LIST) : remplacé si elle diffère, gardé si elle est égale, même avec un autre contenu.Remote size read (LIST): replaced if it differs, kept if it is equal, even with another content. |
Gardé : comme Jamais.Kept: as with never. |
| Écrire à la suite de coché (FTP)Append checked (FTP) | Complété : 29 octets.Extended: 29 bytes. | Compté.Counted. |
| FTPS | Pas de choix : toujours remplacé.No choice: always replaced. | Compté.Counted. |
| Écraser (SFTP, défaut)overwrite (SFTP, default) | Remplacé.Replaced. | Compté.Counted. |
| Écrire à la suite de (SFTP)append (SFTP) | Complété : 29 octets.Extended: 29 bytes. | Compté.Counted. |
| Reprendre (SFTP)resume (SFTP) | Seule la fin manquante est lue, à partir de la taille du fichier local : local de 8 octets, distant de 14, 6 octets lus. Fichier local plus long que le distant : erreur (exemple).Only the missing end is read, from the size of the local file: local of 8 bytes, remote of 14, 6 bytes read. Local file longer than the remote one: error (example). | Compté.Counted. |
En mode ASCII, le serveur envoie le texte avec des fins de ligne CRLF s'il sait convertir ; le client du job, sous Windows, garde ces CRLF tels quels. Deux fichiers téléchargés : lines.txt (texte, 14 octets, fins de ligne LF) et image.png (11 octets, qui contiennent les octets 0D 0A et 0A). Taille du fichier local obtenu :
In ascii mode, the server sends the text with CRLF line ends if it can convert; the client of the job, on Windows, keeps these CRLF as they are. Two files downloaded: lines.txt (text, 14 bytes, LF line ends) and image.png (11 bytes, which contain the bytes 0D 0A and 0A). Size of the local file obtained:
| Mode, serveurMode, server | lines.txt (14) | image.png (11) |
|---|---|---|
| ASCII, serveur qui envoie tel quelascii, server that sends as is | 14, identique14, identical | 11, identique11, identical |
| ASCII, serveur qui convertit (comme ProFTPD)ascii, server that converts (like ProFTPD) | 17 (CRLF)17 (CRLF) |
13 : abîmé13: damaged |
| Binaire, l'un ou l'autrebinary, either one | 14, identique14, identical | 11, identique11, identical |
Le défaut ASCII abîme donc les fichiers binaires avec un serveur qui convertit ; un essai contre un serveur qui ne convertit pas ne le montre pas, et le même job peut se mettre à abîmer les fichiers le jour où le serveur change. Choisissez Binaire, sauf si vous voulez des fins de ligne Windows. En FTPS, le composant n'applique pas le réglage et la connexion reste en binaire (TYPE I seul dans le journal) ; en SFTP, il n'y a pas de mode.
The default ascii thus damages binary files with a server that converts; a test against a server that does not convert does not show it, and the same job can start damaging files the day the server changes. Choose binary, unless you want Windows line ends. With FTPS, the component does not apply the setting and the connection stays binary (only TYPE I in the log); with SFTP, there is no mode.
NB_FILE et TRANSFER_MESSAGES sont disponibles après le composant ; CURRENT_STATUS aussi pendant, à chaque ligne de Fichiers (liens Main ou Iterate).
NB_FILE and TRANSFER_MESSAGES are available after the component; CURRENT_STATUS also during it, at each row of Files (Main or Iterate links).
| VariableVariable | FTP et SFTPFTP and SFTP | FTPS |
|---|---|---|
| NB_FILE Integer |
Fichiers téléchargés. Un fichier gardé par Jamais ou taille différente ne compte pas ; 0 quand rien ne correspond.Files downloaded. A file kept by never or size different does not count; 0 when nothing matches. |
|
| CURRENT_STATUS String |
No file transfered. au début de chaque ligne de Fichiers, File transfer OK. après chaque fichier reçu, File transfer fail. sur un échec ; No file transfered. aussi pour un fichier gardé. null sans ligne.No file transfered. at the start of each row of Files, File transfer OK. after each file received, File transfer fail. on a failure; No file transfered. also for a kept file. null without a row. |
Toujours No file transfered., même quand les fichiers sont reçus.Always No file transfered., even when the files are received. |
| TRANSFER_MESSAGES String |
Une ligne par fichier : file [a.csv] downloaded successfully., file [a.csv] exit transmission. (gardé), file [a.csv] downloaded unsuccessfully. ; puis N files have been downloaded.One line per file: file [a.csv] downloaded successfully., file [a.csv] exit transmission. (kept), file [a.csv] downloaded unsuccessfully.; then N files have been downloaded. |
null |
((Integer) globalMap.get("tFTPGet_1_NB_FILE"))
((String) globalMap.get("tFTPGet_1_CURRENT_STATUS"))
((String) globalMap.get("tFTPGet_1_TRANSFER_MESSAGES"))
Après le composant, CURRENT_STATUS ne décrit que la dernière ligne de Fichiers : si elle n'a rien trouvé, il vaut No file transfered. même quand les lignes précédentes ont téléchargé des fichiers. Testez plutôt NB_FILE. Les chemins de TRANSFER_MESSAGES sont les noms distants, sans dossier. Sur une erreur, le message est aussi dans tFTPGet_1_ERROR_MESSAGE, comme pour tout composant. Le tFTPGet n'a pas de variable CURRENT_FILE_EXISTS.
After the component, CURRENT_STATUS only describes the last row of Files: if it found nothing, it is No file transfered. even when the previous rows downloaded files. Rather test NB_FILE. The names in TRANSFER_MESSAGES are the remote names, without folder. On an error, the message is also in tFTPGet_1_ERROR_MESSAGE, as for any component. The tFTPGet has no CURRENT_FILE_EXISTS variable.
Le code généré enveloppe le traitement de chaque ligne de Fichiers dans une boucle, et y place le composant relié en sortie. Les masques sont calculés avant la boucle, au début du composant. The generated code wraps the handling of each row of Files in a loop, and puts the component connected on the output inside it. The masks are computed before the loop, at the start of the component.
Trois lignes dans Fichiers : "*.csv", "*.txt", "*.xml" (aucun fichier XML), FTP. Le composant relié affiche NB_FILE, CURRENT_STATUS et CURRENT_FILE_EXISTS ; un tJava relié par On Subjob Ok affiche les deux premiers à la fin. Avec un lien Main vers un tJavaRow :
Three rows in Files: "*.csv", "*.txt", "*.xml" (no XML file), FTP. The connected component prints NB_FILE, CURRENT_STATUS and CURRENT_FILE_EXISTS; a tJava connected with On Subjob Ok prints the first two at the end. With a Main link to a tJavaRow:
Flow: NB_FILE = null, CURRENT_STATUS = File transfer OK., CURRENT_FILE_EXISTS = null Flow: NB_FILE = null, CURRENT_STATUS = File transfer OK., CURRENT_FILE_EXISTS = null Flow: NB_FILE = null, CURRENT_STATUS = No file transfered., CURRENT_FILE_EXISTS = null After: NB_FILE = 3, CURRENT_STATUS = No file transfered.
(Le même tJavaRow que pour le tFTPPut : CURRENT_FILE_EXISTS n'existe pas ici et reste null.) Une ligne sans colonne par ligne de Fichiers, pas une par fichier : la première ligne a téléchargé deux fichiers. Un lien Iterate vers un tJava a donné les mêmes trois passages, en FTP comme en SFTP. Pour une itération par fichier reçu, parcourez ensuite le dossier local avec un tFileList.
(The same tJavaRow as for the tFTPPut: CURRENT_FILE_EXISTS does not exist here and stays null.) One row without columns per row of Files, not one per file: the first row downloaded two files. An Iterate link to a tJava gave the same three passes, with FTP as with SFTP. For one iteration per file received, then go through the local folder with a tFileList.
Deux lignes, colonne name : a.csv, notes.txt. Masque de fichier : (String) globalMap.get("row1.name"). Un tJava relié au tFTPGet par On Component Ok affiche NB_FILE et CURRENT_STATUS :
Two rows, name column: a.csv, notes.txt. Filemask: (String) globalMap.get("row1.name"). A tJava connected to the tFTPGet with On Component Ok prints NB_FILE and CURRENT_STATUS:
tFTPGet_1 NB_FILE = 1, CURRENT_STATUS = File transfer OK. tFTPGet_1 NB_FILE = 1, CURRENT_STATUS = File transfer OK.
Chaque itération ouvre sa connexion et télécharge son fichier. Un lien Main direct, row1.name comme masque, arrête le job : le masque est lu avant la première ligne et vaut null (java.lang.NullPointerException: Cannot invoke "String.replaceAll(String, String)" …).
Each iteration opens its connection and downloads its file. A direct Main link, row1.name as the mask, stops the job: the mask is read before the first row and is null (java.lang.NullPointerException: Cannot invoke "String.replaceAll(String, String)" …).
Les sorties sont copiées depuis des exécutions du job (lancé depuis Talaxie, Java 21) contre des serveurs d'essai installés sur le poste : un serveur FTP et FTPS qui répond comme un serveur Unix, et un serveur SFTP (sous-système sftp-server d'OpenSSH). Répertoire distant : "/in", qui contient a.csv (14 octets), b.csv (16), notes.txt (8), sub/c.csv (16) et sub/deeper/d.txt (5). Répertoire local : C:/work/get (chemin raccourci, comme dans les sorties), absent au départ. Mode de transfert : Binaire. Les journaux des serveurs sont des extraits (commandes reçues >, réponses <). Le tJava relié par On Subjob Ok affiche les variables puis les fichiers du dossier local :
The outputs are copied from runs of the job (started from Talaxie, Java 21) against test servers installed on the machine: an FTP and FTPS server that answers like a Unix server, and an SFTP server (sftp-server subsystem of OpenSSH). Remote directory: "/in", which holds a.csv (14 bytes), b.csv (16), notes.txt (8), sub/c.csv (16) and sub/deeper/d.txt (5). Local directory: C:/work/get (shortened path, as in the outputs), missing at the start. Transfer mode: binary. The server logs are excerpts (commands received >, replies <). The tJava connected with On Subjob Ok prints the variables then the files of the local folder:
System.out.println("NB_FILE = " + globalMap.get("tFTPGet_1_NB_FILE"));
System.out.println("CURRENT_STATUS = " + globalMap.get("tFTPGet_1_CURRENT_STATUS"));
System.out.println("TRANSFER_MESSAGES = [" + globalMap.get("tFTPGet_1_TRANSFER_MESSAGES") + "]");
System.out.println("ERROR_MESSAGE = " + globalMap.get("tFTPGet_1_ERROR_MESSAGE"));
java.nio.file.Path base_l = java.nio.file.Paths.get("C:/work/get");
try (java.util.stream.Stream<java.nio.file.Path> walk_l = java.nio.file.Files.walk(base_l)) {
for (java.nio.file.Path p : (Iterable<java.nio.file.Path>) walk_l.filter(java.nio.file.Files::isRegularFile).sorted()::iterator) {
System.out.println("local: " + base_l.relativize(p).toString().replace('\\', '/') + " (" + java.nio.file.Files.size(p) + " bytes)");
}
} catch (java.io.IOException e_l) { System.out.println("local: " + e_l); }
Fichiers : "*.csv".
Files: "*.csv".
NB_FILE = 2 CURRENT_STATUS = File transfer OK. TRANSFER_MESSAGES = [file [a.csv] downloaded successfully. file [b.csv] downloaded successfully. 2 files have been downloaded. ] ERROR_MESSAGE = null local: a.csv (14 bytes) local: b.csv (16 bytes)
Journal du serveur : Server log:
> TYPE I < 200 Type set to I. > TYPE I < 200 Type set to I. > CWD /in < 250 Directory successfully changed. > PWD < 257 "/in" is the current directory. > CWD /in < 250 Directory successfully changed. > PASV > NLST … > RETR a.csv < 150 Opening BINARY mode data connection for a.csv (14 bytes). sent 14 bytes < 226 Transfer complete. … > RETR b.csv … > CWD /in < 250 Directory successfully changed. > QUIT
Le dossier local a été créé. En FTPS (explicite ou implicite), les mêmes fichiers arrivent, mais CURRENT_STATUS vaut No file transfered. et TRANSFER_MESSAGES [null]. En SFTP, la même sortie qu'en FTP.
The local folder was created. With FTPS (explicit or implicit), the same files arrive, but CURRENT_STATUS is No file transfered. and TRANSFER_MESSAGES [null]. With SFTP, the same output as with FTP.
Le même job ; le dossier local contient déjà un a.csv de 15 octets. Écraser le fichier : Jamais (défaut).
The same job; the local folder already holds a 15-byte a.csv. Overwrite file: never (default).
NB_FILE = 1 CURRENT_STATUS = File transfer OK. TRANSFER_MESSAGES = [file [a.csv] exit transmission. file [b.csv] downloaded successfully. 1 files have been downloaded. ] ERROR_MESSAGE = null local: a.csv (15 bytes) local: b.csv (16 bytes)
Le serveur n'a reçu que RETR b.csv. Avec taille différente et un a.csv local de 14 octets mais d'un autre contenu, la sortie est la même : le fichier local, périmé, est gardé.
The server only received RETR b.csv. With size different and a local a.csv of 14 bytes but with another content, the output is the same: the outdated local file is kept.
Le premier exemple avec Afficher le message coché (onglet Paramètres avancés). Les deux premières lignes sont écrites par le tFTPGet, au fil du téléchargement : The first example with Print message checked (Advanced settings tab). The first two lines are written by the tFTPGet, as the download goes:
file [a.csv] downloaded successfully. file [b.csv] downloaded successfully. NB_FILE = 2 CURRENT_STATUS = File transfer OK. TRANSFER_MESSAGES = [file [a.csv] downloaded successfully. file [b.csv] downloaded successfully. 2 files have been downloaded. ] ERROR_MESSAGE = null local: a.csv (14 bytes) local: b.csv (16 bytes)
Dans le dossier local : a.csv interrompu (ses 8 premiers octets) et b.csv de 22 octets, plus long que le fichier distant. Nom du job remplacé par MyJob, pile abrégée :
In the local folder: an interrupted a.csv (its first 8 bytes) and a 22-byte b.csv, longer than the remote file. Job name replaced with MyJob, shortened stack:
Exception in component tFTPGet_1 (MyJob) 4: failed to resume for C:/work/get\b.csv at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:934) …
Journal du serveur SFTP : SFTP server log:
sftp-server: opendir "/in/." sftp-server: closedir "/in/." sftp-server: open "/in/a.csv" flags READ mode 0666 sftp-server: close "/in/a.csv" bytes read 6 written 0
a.csv a reçu ses 6 derniers octets et est complet ; b.csv est resté tel quel. Le contenu déjà présent n'est pas comparé : Reprendre suppose que le début du fichier local est juste.
a.csv received its last 6 bytes and is complete; b.csv was left as it was. The content already there is not compared: resume assumes that the start of the local file is right.
FTP, connexion ouverte dans /. Les deux tFTPGet ont Utiliser une connexion existante coché, le même Répertoire distant relatif "in", et téléchargent a.csv puis b.csv. Avec Déplacer vers le répertoire courant coché (défaut) :
FTP, connection opened in /. Both tFTPGet have Use an existing connection checked, the same relative Remote directory "in", and download a.csv then b.csv. With Move to the current directory checked (default):
Exception in component tFTPGet_2 (MyJob) java.lang.RuntimeException: Failed to change remote directory. 550 in: No such directory. at demo.myjob_0_1.MyJob.tFTPGet_2Process(MyJob.java:1212) …
Le premier composant a laissé la connexion dans /in ; le second y a cherché in. Case décochée, chaque tFTPGet revient à / (CWD /) et les deux fichiers arrivent. Avec un Répertoire distant absolu ("/in"), la case n'a pas d'importance.
The first component left the connection in /in; the second one looked for in there. Box unchecked, each tFTPGet goes back to / (CWD /) and both files arrive. With an absolute Remote directory ("/in"), the box does not matter.
Messages relevés dans la console (première ligne de l'exception, ou message écrit sur la sortie d'erreur). Une exception arrête le job avec le code 1, sauf si un lien On Component Error ou On Subjob Error la reprend. Messages seen in the console (first line of the exception, or message written to the error output). An exception stops the job with code 1, unless an On Component Error or On Subjob Error link takes it over.
| CasCase | Message | Arrêter en cas d'erreur décochéDie on error unchecked |
|---|---|---|
| Fichier distant absentMissing remote file | aucun : NB_FILE = 0, No file transfered.none: NB_FILE = 0, No file transfered. |
De même.The same. |
| Répertoire distant absent (FTP, FTPS)Missing remote directory (FTP, FTPS) | java.lang.RuntimeException: Failed to change remote directory. 550 /nosuch: No such directory. |
Le job s'arrête quand même ; le dossier local n'est pas créé.The job stops anyway; the local folder is not created. |
| Répertoire distant absent (SFTP)Missing remote directory (SFTP) | 2: No such file |
Le job s'arrête quand même.The job stops anyway. |
Sous-dossier du masque absent ("nosuch/*.csv"), FTPMissing subfolder of the mask ("nosuch/*.csv"), FTP |
aucun : le masque est appliqué au dossier courant, et a.csv, b.csv de /in ont été téléchargés.none: the mask is applied to the current folder, and a.csv, b.csv of /in were downloaded. |
De même.The same. |
| Sous-dossier du masque absent, SFTPMissing subfolder of the mask, SFTP | 2: No such file |
No such file sur la sortie d'erreur (sans retour à la ligne), puis la ligne suivante de Fichiers.No such file on the error output (without a line break), then the next row of Files. |
Le serveur refuse d'envoyer un nom listé (FTP, réponse 550)The server refuses to send a listed name (FTP, 550 reply) |
aucun. Avec Toujours, un fichier local vide reste, sans message ; avec Jamais, il est supprimé ; avec Écrire à la suite de, file [archive.csv] downloaded unsuccessfully. dans TRANSFER_MESSAGES.none. With always, an empty local file stays, without a message; with never, it is deleted; with Append, file [archive.csv] downloaded unsuccessfully. in TRANSFER_MESSAGES. |
De même.The same. |
| Mot de passe refusé (FTP)Password rejected (FTP) | java.lang.RuntimeException: Login failed |
Le job s'arrête quand même.The job stops anyway. |
| Reprendre, fichier local plus long (SFTP)resume, longer local file (SFTP) | 4: failed to resume for C:/work/get\b.csv |
Le message, puis la ligne suivante de Fichiers (les fichiers restants de la ligne en cours ne sont pas téléchargés).The message, then the next row of Files (the remaining files of the current row are not downloaded). |
Le cas du nom listé que le serveur refuse a été provoqué par un dossier nommé archive.csv dans /in : le NLST de FTP ne distingue pas fichiers et dossiers, et le composant a demandé ce dossier comme un fichier. En SFTP, les dossiers sont écartés. La connexion elle-même (hôte, port, certificat, clé) est traitée sur la page du tFTPConnection.
The case of the listed name refused by the server was caused by a folder named archive.csv in /in: the FTP NLST does not tell files from folders, and the component asked for this folder as a file. With SFTP, folders are skipped. The connection itself (host, port, certificate, key) is dealt with on the tFTPConnection page.
Un fichier attendu qui n'est pas encore sur le serveur donne NB_FILE = 0 et le job continue par On Subjob Ok. Si le fichier est obligatoire, testez-le : Run if ((Integer) globalMap.get("tFTPGet_1_NB_FILE")) == 0 vers un tDie, ou un tFTPFileExist avant.
An expected file that is not on the server yet gives NB_FILE = 0 and the job goes on through On Subjob Ok. If the file is mandatory, test it: Run if ((Integer) globalMap.get("tFTPGet_1_NB_FILE")) == 0 to a tDie, or a tFTPFileExist before.
En FTP, le Mode de transfert vaut ASCII au dépôt du composant : avec un serveur qui convertit, une image ou une archive arrive abîmée, sans erreur, et un texte arrive avec des fins de ligne Windows (voir Le mode de transfert). Passez-le à Binaire. With FTP, the Transfer mode is ascii when the component is dropped: with a server that converts, an image or an archive arrives damaged, without an error, and a text arrives with Windows line ends (see The transfer mode). Set it to binary.
En FTP, un masque "nosuch/*.csv" dont le dossier n'existe pas ne provoque aucune erreur : le composant liste le dossier où il se trouve et télécharge ce qui y correspond (voir Erreurs). Vérifiez les dossiers des masques, ou mettez le dossier dans le Répertoire distant, qui est, lui, contrôlé.
With FTP, a "nosuch/*.csv" mask whose folder does not exist causes no error: the component lists the folder it is in and downloads what matches there (see Errors). Check the folders of the masks, or put the folder in the Remote directory, which is checked.
"/" ou "." et masques à sous-dossier"/" or "." remote directory and masks with a subfolder
Quand le dossier de départ est la racine /, le composant ne revient pas à la racine après une ligne de Fichiers qui contient un sous-dossier : les lignes suivantes sont cherchées dans ce sous-dossier. Répertoire distant "/", lignes "in/sub/*.csv", "in/*.txt", "*.txt", et un top.txt à la racine :
When the starting folder is the root /, the component does not go back to the root after a row of Files that contains a subfolder: the next rows are looked for in this subfolder. Remote directory "/", rows "in/sub/*.csv", "in/*.txt", "*.txt", and a top.txt at the root:
NB_FILE = 1 CURRENT_STATUS = No file transfered. TRANSFER_MESSAGES = [file [c.csv] downloaded successfully. 1 files have been downloaded. ] ERROR_MESSAGE = null local: c.csv (16 bytes)
Le journal montre CWD in/sub, puis CWD in refusé depuis /in/sub : notes.txt et top.txt n'ont pas été trouvés. Avec "/in" comme Répertoire distant et des masques relatifs à lui, le composant revient bien à /in entre deux lignes.
The log shows CWD in/sub, then CWD in refused from /in/sub: notes.txt and top.txt were not found. With "/in" as the Remote directory and masks relative to it, the component does go back to /in between two rows.
Seule la taille est comparée : un fichier distant modifié qui garde la même taille (une date, un code changés) n'est pas téléchargé, et la copie locale reste périmée (exemple). Pour une copie fiable, prenez Toujours. Only the size is compared: a modified remote file that keeps the same size (a date, a code changed) is not downloaded, and the local copy stays outdated (example). For a reliable copy, take always.
En FTPS, CURRENT_STATUS reste No file transfered., TRANSFER_MESSAGES est null, Afficher le message et Mode de transfert n'existent pas, et un fichier local déjà présent est toujours remplacé. Seul NB_FILE renseigne.
With FTPS, CURRENT_STATUS stays No file transfered., TRANSFER_MESSAGES is null, Print message and Transfer mode do not exist, and a local file already there is always replaced. Only NB_FILE tells something.
Les fichiers téléchargés restent sur le serveur, et un second lancement les retélécharge. Pour ne traiter chaque fichier qu'une fois, supprimez-le (tFTPDelete) ou rangez-le dans un dossier d'archive (tFTPRename) après le téléchargement, avec la même connexion. The downloaded files stay on the server, and a second run downloads them again. To handle each file only once, delete it (tFTPDelete) or move it to an archive folder (tFTPRename) after the download, with the same connection.
En FTP avec Toujours, le fichier local est ouvert avant la demande au serveur : si le serveur refuse, un fichier vide reste, sans message, et un fichier local qui existait est vidé. Un traitement qui lit ensuite tout le dossier local trouve ce fichier vide. With FTP and always, the local file is opened before the request to the server: if the server refuses, an empty file stays, without a message, and a local file that existed is emptied. A process that then reads the whole local folder finds this empty file.
Les autres composants de la famille Internet › FTP, et ceux qui servent avec le tFTPGet : The other components of the Internet › FTP family, and those used with the tFTPGet:
tFTPPut · envoie des fichiers sur le serveuruploads files to the servertFTPConnection · ouvre une connexion partagée, et décrit ses réglagesopens a shared connection, and describes its settingstFTPClose · ferme la connexion partagéecloses the shared connectiontFTPFileList · itère sur les fichiers distantsiterates over the remote filestFTPFileExist · vérifie qu'un fichier distant existechecks that a remote file existstFTPFileProperties · taille et date d'un fichier distantsize and date of a remote filetFTPDelete · supprime les fichiers téléchargésdeletes the downloaded filestFTPRename · range les fichiers téléchargésmoves the downloaded filestFileList · parcourt le dossier local ensuitethen goes through the local folder