on 06-11-2012 7:02 PM
Hi,
Is it possible through PI; to count the number of files on perticular server and perticular folder on perticular date, and report it through email?
finding the ways to do it.
I would suggest you to handle this requirement using Shell scripts , because very much possible and easy to implement using Scripts/
If you keen on implementing PI then mapping level you have to perform File lookup to find the number of files.
Even you can try using Adapter modules also.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prema.
I am Not good in scripting , take help from UNIX Team for them it is 10 mnts job to write to script which can give number if files based on your logic.
Please search in web.
Once your Script ready then you can execute script stand alone or using PI communication channel.
But some client dont prefer this approach this case using java maping or UDF you can achive it but you have to perfrom file look and have to to write logic in UDF/Java mapping.
Regards,
Raj
Adapter module is last option to consider insted of adapter module try below appraoch
1)Develop dummy interfacem like creare one dummy folder and point sender communictaion channel to connect Dummy folder to run Interface,
2)Mapping level write a Java mapping to connect FTP(File look up very much possible) and count number of files(using JAVA this is very easy) and JAVA Mapping returns number of files .
3)Send JAVA Mpaping out to via email using Mail adapter.
check below link , even UDF also works.
Btw, did you get chance to read the links that I provided in my previous reply? Create simple java File class and you can retrieve details about the file system from it. In addition to previous reply, go through this links for further help.
list of files in a specific directory logic
http://www.codebeach.com/2008/03/get-list-of-files-in-directory-using.html
sort files for date
Ok let me explain my scenario:
i have interface File-->PI-->File. As soon as this interface completes i need to trigger email with no' of files created on target system.
i see from the below link from Baskar; there is something called " File change notification"
WatchServicewatcher = FileSystems.getDefault().newWatchService();
Path dir = ...
WatchKeykey = dir.register(watcher, ENTRY_CREATE);
for (;;) {
WatchKeykey = watcher.take();
for (WatchEvent<?> event: key.pollEvents()) {
if (event.kind() == ENTRY_CREATE) {
Path name = (Path)event.context();
System.out.format(“%s created%n”, name);
}
}
key.reset();
}
how do i make use of this?
One possible way is using java mapping and inside the mapping use the following java classes to find out details about files and in the receiver system use mail adapter to send mail.
use File class to get file system details and then pass the output to the mail receiver system.
Refer below links
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html
http://www.oracle.com/us/technologies/java/file-system-api-428204.pdf
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.