?
Solved

Queries

Posted on 2003-03-18
8
Medium Priority
?
218 Views
Last Modified: 2010-03-31
Hi all,

I have 2 following queries.

a. How do I chk in Win2K/Win NT whether the logged in User logged in is having administrative right uing Java ?
b. Uing Java I would like to copy Folder(sub-folders) from one location to another

Thanks in advance

Regard
Tridib
0
Comment
Question by:tridib
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Expert Comment

by:allahabad
ID: 8164103
System.out.println( "os : "+ System.getProperty("os.name"));
0
 
LVL 3

Expert Comment

by:allahabad
ID: 8164130
For question b. here is example for 1.4
http://javaalmanac.com/egs/java.nio/File2File.html
0
 
LVL 3

Expert Comment

by:allahabad
ID: 8164154
file Copy :

public static void copyFile(File source, File target) throws IOException
{
    FileInputStream in = new FileInputStream(source);
    FileOutputStream out = new FileOutputStream(target);
    byte[] buffer = new byte[1024];
    int read = -1;
    while ((read = in.read(buffer, 0, buffer.length)) != -1)
    {
        out.write(buffer, 0, read);
    }
}
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:tridib
ID: 8164577
hi allahabad,

thanks for yr reply.

however as per my question b) i am looking for folder copy from one location to another, alongwith the subfolders.

looking for yr help

regards
tridib
0
 
LVL 2

Expert Comment

by:glottis
ID: 8164622
u mean the old DOS style way. then i think the sollution by allahbad is ok only changes u have to make is to add recursion in to it.
0
 

Author Comment

by:tridib
ID: 8164781
hi allahabad,

thanks for yr reply.

however as per my question b) i am looking for folder copy from one location to another, alongwith the subfolders.

looking for yr help

regards
tridib
0
 
LVL 1

Expert Comment

by:Jitu
ID: 8201685
listening...
0
 
LVL 2

Accepted Solution

by:
glottis earned 300 total points
ID: 8201784
u can see if the File is a directory or not..
File f = new File("c:\java");
if (f.isDirectory) {
 ... do some work
}

create a method which accepts to File objects (File source, File target)

see if source is directory if it is the make a new directory by that name in target.

then list all files in source with the command source.listAll() // i think better check in java.io.File.

then recurse the method you have made.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question