on 10-18-2016 12:22 AM
Hello All,
We have a requirement of reading the file names present on shared location in a BODS script, these files should be assigned to global variable FILE_NAME.
Our Job should check the file path, if file exists, should pick one file at a time, do the loading in respective targets and archive the file.
On the next run it should pick another file and take it forward(file name keep on changing every fortnight) and also we cannot assign the file names manually to the global variable.
I tried below command to get the list of all files present at the file path, however this is not helping me to assign it to the variable
print(exec('cmd','dir "[$File_Path]*.csv"',8));
I was thinking if there is any function by which we can get the latest modified timestamp of the file present on shared location.
Can anyone suggest me the solution on how we can get the file names assigned to global variable?
Use
print(word(exec('cmd','dir /b [$File_Path]*.zip',8),2));
/b stands for bare format, returns file names only, no heading information nor summary.
exec with 2nd parameter value 8 returns code first, then list of filenames, separated by blanks. The first file name is the 2nd word
Make sure $File_Path ends with a backslash
When you archive every processed file (move to another folder), you'll always process the next one automatically.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dirk,
I am using same but not getting the file name from a directory. instead it is printing something 'The'.
$G_File_Name =(word(exec('cmd','dir /b [$Sales_Load_Direcotry]*.txt',8),2));
print($G_File_Name);
$$Sales_Load_Direcotry= C:\Training Files\New folder\
$G_File_Name is a global variable here
Have been trying to post question's but doesn't take, that's why posted here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi experts, need your help. could you please solve this problem ASAP
1) Once processed the .txt files , it should move to ARCHIVE folder. For this have seen more post's they were mentioned
exec('cmd','move<source path><target path>,8) this is fine ,it's working but
My requirement is
2) Success-full files should move to one folder and failure files should move to another folder, as well as if file doesn't have even single record(ROW) ,this kind of files should move to another folder.
Thanking you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Refer below example which is beautifully explained by Sean Hayward
http://bodataservices.blogspot.nl/2014/10/files-as-data-sources-part-1-waiting.html
http://bodataservices.blogspot.nl/2014/11/files-as-data-sources-part-2-keeping.html
Regards
Arun Sasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.