AAaa
AAaa

Reputation: 3819

java operation on Files - java.io.File or cmd commands

i need to perform some operations on files - rename, delete and etc.

what is better? use cmd commands or use java.io.File methods?

thanks.

Upvotes: 0

Views: 298

Answers (2)

Mihran Hovsepyan
Mihran Hovsepyan

Reputation: 11108

After lots of comments I catch the real question. So my answer is:

Of course it is better to use java feauters, because:

  1. If you wan't your program to be portable you can't use command line, because it wouldn't work on unix or other systems expect windows. Also can't work on some other versions of windows.
  2. To use command line feautures from your code you should creat new process end execute this commands, which is very slow.

Upvotes: 0

KARASZI István
KARASZI István

Reputation: 31467

Normally it's not a good idea to depend on OS specific things in a platform independent environment, not mentioning the speed which would be much slower with the local commands.

I would stick with the Java implementations, if it's possible with them.

Upvotes: 1

Related Questions