Solved

How can I rename a file on a server?

Posted on 2003-12-04
5
201 Views
Last Modified: 2010-04-01
Well how can I rename a file on a server?
The file is allready been uploaded by the admin. And I would like to rename this file to, for example the old filename is "johnny.jpg" and by renaimng this file it should be: new filename "10.jpg".

Could anyone help me??

Many thanks!!!!!
0
Comment
Question by:jrbiemans
[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
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
kennethxu earned 100 total points
ID: 9876742
import java.io.*;

File oldName = new File( "/path/to/yourfile/johnny.jpg" );
File newName = new File( "/path/to/newfile/10.jpg" );
oldName.renameTo( newName );

let me know if you have futher enquires.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9876746
and welcome to expert-exchange :-)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 9926300
Make sure its not read-only.

Mayank.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

705 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