Solved

How can I rename a file on a server?

Posted on 2003-12-04
5
195 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
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
kennethxu earned 100 total points
Comment Utility
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
Comment Utility
and welcome to expert-exchange :-)
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Make sure its not read-only.

Mayank.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now