Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9146

Re: Idoc to file with file name as ABCD timestamp and count

$
0
0

Hi Vinoth,

 

Below is the code. Use it in-conjunction with your dynamic config code.

 

String inputFile = "D:\\Receiver"; //This is your target receiver folder   String dateStr = DateFormat.getDateInstance().format(new Date());  dateStr = dateStr.substring(0, 2)+ dateStr.substring(3, 5)+ dateStr.substring(8,10);   final String fileNamePattern = "DEFAULT"+dateStr;  File file = new File(inputFile);  File[] listFiles = file.listFiles(new FilenameFilter() {  @Override  public boolean accept(File dir, String name) {  if(name.contains(fileNamePattern))  return true;  return false;  }  });  //System.out.println("Number of files in the directory "+inputFile+" : Next Counter"+ (listFiles.length+1));  int counter = listFiles.length+1;  String fileName = "";  if(counter < 10)  fileName = fileNamePattern+0+counter;  else  fileName = fileNamePattern+counter;  System.out.println("Name of the file will be:"+fileName);  }

Hope it helps!

 

 

Best Regards,

Anand Patil


Viewing all articles
Browse latest Browse all 9146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>