By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,842 Members | 1,608 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,842 IT Pros & Developers. It's quick & easy.

Best way to search a text in the file and copy the file

P: 184
Hi All,

In my java application, i need to search a string (Eg: "Hello") in the list of files in the source directory and i need to copy all the files that matches the search text and copy all those files into another destination directory.


In my source directory i have lot more number of files , probably 10,000+. I am not sure , whether iterating the files and searching the string using java scanners and copying the file using read() or filechannel() would impact the performance.

Can anyone share the best way of searching the string in the list of files and copy the files too.

Thanks in Advance.
Sep 7 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.