Friday, 22 April 2011

Getting several unknown files from a directory to a file in unix or windows

Dear Friends,

  Today Let me share an idea about how to get the names of files in a directory of unix system.
There are times we need to populate target table with a flat file resources but we dont know the flat file names.
Then you can use the following procedure to get the names of unknown files in a directory and write to another file line by line so that each line of this file contains file names which are required to populate target table. Create an ODI Procedure with a single step.
Source Tab Technology: OS Command 
 if windows : Code:  cmd /c dir c:\my_directory\*.* /b /a:-d > c:\my_directory\All_Files_Names.txt
if linux :  code:  ls >Files_Names.txt
Now populate this file Files_Names.txt to target table as SRC_DETAILS table using an interface.




No comments:

Post a Comment