?
Solved

How can I rename a file on a server?

Posted on 2003-12-04
5
Medium Priority
?
202 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
What's worse than having your data encrypted by ransomware? Getting attacked by a so-called "wiper," which simply destroys the data and offers you no hope of ever seeing it again.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

743 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