Using the tSystem component


You often start out using tSystem with a simple command, just to check that the component works the way you want it to, but even a simple dir (Windows) or ls (Linux/Unix/OSX) does not return what you expect it to.


If you run:

dir *.txt


You might get this in return:

dir: cannot access '*.txt': No such file or directory


This may be because there are actually no files ending in .txt in the directory, or you are not looking in the directory you think you are. Fortunately in Windows, the dir command tells you where you are looking, but you have to make sure you use the full cmd /c option that is set up by default in Studio. In Linux/Unix/OSX, it is /bin/bash -c.

cmd /c dir *.txt


  • To review the Help documentation for cmd, see the Microsoft cmd page.

  • To review the 'man' page for Bash, see the Linux man-pages project bash page.


In both cases (Windows and the *nix's), you are taking a set of commands and passing them to a shell/interpreter. This alters how the command is run, how the operating system interacts with the tSystem component. The output of the above command (cmd /c dir *.txt) would now be:

 Volume in drive C has no label.
 Volume Serial Number is ACD6-02C1

 Directory of C:\Talend\6.4.1\studio

06/23/2017  05:37 AM            81,252 license.txt
06/23/2017  05:37 AM            41,890 NOTICE.txt
               2 File(s)        123,142 bytes
               0 Dir(s)  377,403,498,496 bytes free


You now get more information, including the directory you are actually examining: c:\Talend\6.4.1\studio. This means that the Studio install directory is the default directory that the tSystem component will run in.


You can change your command to look at another directory, for example:

cmd /c dir c:\\temp\\*.txt


Notice that you have to escape backslashes with a backslash. The tSystem component is generally capable of handling pipes and even redirects:

cmd /c dir c:\\temp\\*.txt | grep out >> files_with_out_in_their_names.txt 2> /dev/null

This command gets a listing of all .txt files in the c:\temp directory, finds those with out in their filenames, appends those filenames to the output file files_with_out_in_their_names.txt, and sends any error output (STDERR) to /dev/null (the bitbucket/nowhere/infinity/no-man's-land).


You might also take advantage of the Home Directory checkbox to change where your command starts running from:



Version history
Revision #:
9 of 9
Last update:
‎12-28-2017 06:10 PM
Updated by: