ComposantsComponents › Fichier › GestionFile › Management
Lit les propriétés d'un fichier (chemin complet, dossier, nom, droits de lecture et d'écriture, taille, date de modification et, sur demande, empreinte MD5) et les envoie en une seule ligne dans un flux. Après un tFileList relié par Iterate, il donne une ligne par fichier du dossier. Reads the properties of a file (full path, folder, name, read and write rights, size, modification date and, on request, MD5 hash) and sends them as a single row in a flow. After a tFileList connected with Iterate, it gives one row per file of the folder.
EntréeInput
Aucune : il commence son sous-job. Sinon un lien Iterate. None: it starts its subjob. Otherwise one Iterate link.
SortieOutput
Main un flux : une ligne, avec le schéma fixe. Sans ce lien, le composant ne fait rien.one flow: one row, with the fixed schema. Without this link, the component does nothing.
Un lien Iterate est aussi accepté : ses composants s'exécutent une fois. An Iterate link is also accepted: its components run once.
Déclencheurs en sortieOutput triggers
On Subjob Ok On Subjob Error On Component Ok On Component Error Run if
On Subjob : seulement quand il commence son sous-job. On Subjob: only when it starts its subjob.
Une ligne sort, avec la taille, la date et, si demandé, le MD5 du fichier : à afficher, à écrire dans un journal ou à comparer à une valeur attendue. One row comes out, with the size, the date and, if requested, the MD5 of the file: to print, to write to a log or to compare with an expected value.
"C:/data/in/orders.csv". Cochez Calculer le hachage MD5 si vous voulez l'empreinte : la colonne md5 s'ajoute au schéma.
Set the File, as a Java expression: "C:/data/in/orders.csv". Check Calculate MD5 Hash if you want the hash: the md5 column is added to the schema.
Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings.
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| SchémaSchemaSCHEMA | 7 colonnes fixes7 fixed columns | ToujoursAlways |
En lecture seule : les colonnes de la ligne de sortie. Une huitième, md5, s'ajoute quand Calculer le hachage MD5 est coché.
Read-only: the columns of the output row. An eighth one, md5, is added when Calculate MD5 Hash is checked.
|
| FichierFileFILENAME | chemin par défaut des composants + /file.txtcomponent default path + /file.txt |
ToujoursAlways |
Le fichier à décrire, en expression Java. Un dossier est accepté (sans MD5). Un chemin qui n'existe pas ne provoque pas d'erreur : la ligne sort quand même, avec toutes ses colonnes à null.
The file to describe, as a Java expression. A folder is accepted (without MD5). A path that does not exist causes no error: the row still comes out, with all its columns null.
|
| Calculer le hachage MD5Calculate MD5 HashMD5 | NonNo | ToujoursAlways |
Lit tout le fichier pour calculer son empreinte MD5, écrite dans md5 en 32 chiffres hexadécimaux minuscules. Deux fichiers de même contenu ont le même MD5. Sur un dossier, le job s'arrête (voir les erreurs).
Reads the whole file to compute its MD5 hash, written in md5 as 32 lowercase hexadecimal digits. Two files with the same content have the same MD5. On a folder, the job stops (see the errors).
|
Les colonnes du schéma, dans l'ordre. Toutes valent null si le fichier n'existe pas.
The schema columns, in order. All of them are null if the file does not exist.
\, même si le Fichier est écrit avec des /.Full (absolute) path. On Windows, with \, even if the File is written with /.orders.csv.File name, without the folder: orders.csv.r si le fichier peut être lu, w s'il peut être écrit, - sinon. rw d'habitude, r- pour un fichier en lecture seule. Pas de droit d'exécution.Two characters: r if the file can be read, w if it can be written, - otherwise. Usually rw, r- for a read-only file. No execute right.0 pour un dossier (ici sous Windows).Size in bytes. 0 for a folder (here on Windows).new java.util.Date(row1.mtime) en fait une date.Last modification date, in milliseconds since January 1st, 1970 (UTC). new java.util.Date(row1.mtime) turns it into a date.Tue Nov 10 13:51:54 CET 2026), dans le fuseau horaire de la machine.The same date as text, in the fixed Java format (Tue Nov 10 13:51:54 CET 2026), in the time zone of the machine.
Les sorties sont celles de la console, copiées depuis une exécution du job. Les chemins sont abrégés en C:/data (C:\data), et les cadres du tLogRow ajustés à cette longueur.
The outputs are the console ones, copied from a run of the job. The paths are shortened to C:/data (C:\data), and the tLogRow frames adjusted to this length.
Fichier : "C:/data/orders.csv" (4 lignes, 26 octets) ; Calculer le hachage MD5 coché ; tLogRow en mode Vertical.
File: "C:/data/orders.csv" (4 lines, 26 bytes); Calculate MD5 Hash checked; tLogRow in Vertical mode.
.-------------------------------------------------. | #1. tLogRow_1 | +--------------+----------------------------------+ | key | value | +--------------+----------------------------------+ | abs_path | C:\data\orders.csv | | dirname | C:\data | | basename | orders.csv | | mode_string | rw | | size | 26 | | mtime | 1794315114766 | | mtime_string | Tue Nov 10 13:51:54 CET 2026 | | md5 | 78fd2af823cbbca8cfec35ce421abd07 | +--------------+----------------------------------+
Le MD5 est celui que donne md5sum orders.csv.
The MD5 is the one given by md5sum orders.csv.
tFileProperties_1 : "C:/data/orders_2026.csv", qui n'existe pas. tFileProperties_2 : "C:/data/sub", un dossier. MD5 non coché, deux sous-jobs reliés par On Subjob Ok.
tFileProperties_1: "C:/data/orders_2026.csv", which does not exist. tFileProperties_2: "C:/data/sub", a folder. MD5 unchecked, two subjobs connected with On Subjob Ok.
.----------------------. | #1. tLogRow_1 | +--------------+-------+ | key | value | +--------------+-------+ | abs_path | null | | dirname | null | | basename | null | | mode_string | null | | size | null | | mtime | null | | mtime_string | null | +--------------+-------+ .---------------------------------------------. | #1. tLogRow_2 | +--------------+------------------------------+ | key | value | +--------------+------------------------------+ | abs_path | C:\data\sub | | dirname | C:\data | | basename | sub | | mode_string | rw | | size | 0 | | mtime | 1794315114766 | | mtime_string | Tue Nov 10 13:51:54 CET 2026 | +--------------+------------------------------+
Le job se termine normalement : le fichier absent donne une ligne de null, pas une erreur.
The job ends normally: the missing file gives a row of null, not an error.
tFileList : dossier "C:/data", masques "orders*.csv" et "locked.csv". tFileProperties : Fichier ((String) globalMap.get("tFileList_1_CURRENT_FILEPATH")), MD5 coché. locked.csv est en lecture seule.
tFileList: folder "C:/data", masks "orders*.csv" and "locked.csv". tFileProperties: File ((String) globalMap.get("tFileList_1_CURRENT_FILEPATH")), MD5 checked. locked.csv is read-only.
// tJavaRow_1
System.out.println(input_row.basename + " " + input_row.mode_string + " "
+ input_row.size + " " + input_row.md5);
locked.csv r- 7 6695bfad5b17c19efd236a560f93f620 orders.csv rw 26 78fd2af823cbbca8cfec35ce421abd07 orders_changed.csv rw 26 3e25db4e0132c16f2987fc9b71f329ea orders_copy.csv rw 26 78fd2af823cbbca8cfec35ce421abd07 orders_crlf.csv rw 30 262ccf2366b54ea123a2a883f9464bdf orders_noeol.csv rw 25 35eb3748e6366ad7ef9af522449a32d1
orders.csv et orders_copy.csv ont le même contenu, donc le même MD5. orders_changed.csv a la même taille, mais un chiffre diffère : le MD5 change. orders_crlf.csv a les mêmes lignes, terminées par \r\n.
orders.csv and orders_copy.csv have the same content, so the same MD5. orders_changed.csv has the same size, but one digit differs: the MD5 changes. orders_crlf.csv has the same lines, ended with \r\n.
Le nom du job est remplacé par MyJob, le chemin abrégé et la trace d'exception raccourcie.
The job name is replaced with MyJob, the path shortened and the exception trace cut.
Fichier "C:/data/sub", un dossier, avec Calculer le hachage MD5 coché :
File "C:/data/sub", a folder, with Calculate MD5 Hash checked:
Exception in component tFileProperties_1 (MyJob) java.io.FileNotFoundException: C:\data\sub (Accès refusé) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:213) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152) at demo.myjob_0_1.MyJob.tFileProperties_1Process(MyJob.java:1279) …
Un dossier ne se lit pas comme un fichier ; la fin du message vient du système (ici un Windows en français). Le job s'arrête avec le code 1 et aucune ligne ne sort. Sans MD5, le même dossier donne une ligne normale. A folder cannot be read like a file; the end of the message comes from the system (here a Windows in French). The job stops with exit code 1 and no row comes out. Without MD5, the same folder gives a normal row.
nullMissing file: null values
Un fichier absent ne fait pas échouer le composant ; les composants suivants reçoivent une ligne de null. Testez si abs_path est null (dans un tFilterRow ou un tJavaRow), ou placez un tFileExist avant.
A missing file does not make the component fail; the next components receive a row of null. Test whether abs_path is null (in a tFilterRow or a tJavaRow), or put a tFileExist before.
Le code du composant n'est produit que s'il a un lien Main en sortie. Seul, il ne lit rien : même avec MD5 sur un dossier, le job se termine sans erreur. The component code is only generated if it has an outgoing Main link. Alone, it reads nothing: even with MD5 on a folder, the job ends without error.
mtime_string a un format fixe, en anglais, qui dépend du fuseau horaire. Pour un autre format ou pour comparer des dates, partez de mtime, un nombre.
mtime_string has a fixed format, in English, that depends on the time zone. For another format or to compare dates, start from mtime, a number.
Le MD5 oblige à lire tout le fichier : sur de gros fichiers, ne le cochez que s'il sert. Pour savoir si deux fichiers sont identiques, comparez leurs MD5 ou prenez un tFileCompare.
The MD5 means reading the whole file: on large files, only check it if it is used. To know if two files are identical, compare their MD5 or take a tFileCompare.
tFileList · parcourir les fichiers d'un dossiergo through the files of a foldertFileExist · tester si un fichier existetest whether a file existstFileRowCount · compter les lignes d'un fichiercount the lines of a filetFileCompare · comparer un fichier à un fichier de référencecompare a file with a reference filetIterateToFlow · une ligne par itération, sans les propriétésone row per iteration, without the propertiestLogRow · afficher la ligne dans la consoleprint the row in the console