Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Command line arguments in java for file path  RSS feed

 
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
 
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:
 
Marshal
Posts: 59108
180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
… and welcome to the Ranch
 
Would you like to try a free sample? Today we are featuring tiny ads:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!