Solved

How can I rename a file on a server?

Posted on 2003-12-04
5
200 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
parse example 13 97
nested if has else if 13 100
Limiting the number of characters a user can type in a text field 6 70
main method of string class 3 123
I took on this little project as a proof of concept for IoT devices. My main goals were to find the easiest, cheapest way to stream data to the cloud. This article describes how to stream telemetry data to ThingSpeak via REST API. This can also be d…
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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