Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Command line arguments in java for file path  RSS feed

 
stiffany lotismo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need Java code that will parse given file path and search it using command line arguments.

Example: running

java arguments /home/documents/pictures/first.txt /home/var/second.txt
After the file is being searched, the content of each file will be copied to other new txt file and place it on the desktop. Example: the content of first.txt is "Hello world welcome to Programming" and then will be copied. So first create a file. Let's say newfirst.txt and it must on the desktop. the content of newfirst.txt is the same as first.txt . same as the second.txt

Any links or code samples will be helpful.

Thanks, Sir
 
Rico Felix
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Operations such as these can be easily achieved using the API's located in the java.nio.file package...

Illustration:
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
… and welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!