473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anyway to rename a current File with out creating a new File object.

Basically I have this little program that will look through directories and
rename any file it finds. The renaming that takes place is like removing of
dashes or Caps the first letter from each word and so on. Is there a better
way to rename the files instead of creating a new file and calling
originalFile.re nameTo(new File(newFilenam e)); Basically I want to know if
creating this new File each time will be costly in both memory and time when
I run the program on hundreds of files. Is there some way to just change the
string of the current file without creating a totally new file?
Thanks Alot

Jul 17 '05 #1
1 1817
Liz
pls don't xpost

"C-man" <ia********@sha w.ca> wrote in message
news:DE2cc.1097 4$J56.2402@edtn ps89...
Basically I have this little program that will look through directories and rename any file it finds. The renaming that takes place is like removing of dashes or Caps the first letter from each word and so on. Is there a better way to rename the files instead of creating a new file and calling
originalFile.re nameTo(new File(newFilenam e)); Basically I want to know if
creating this new File each time will be costly in both memory and time when I run the program on hundreds of files. Is there some way to just change the string of the current file without creating a totally new file?
Thanks Alot

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
2946
by: Michael Strorm | last post by:
Hi! I posted a message a while back asking for project suggestions, and decided to go with the idea of creating an adventure game (although it was never intended to be a 'proper' game, rather an excuse to write- and learn- some C++). To cut a long story short, I wrote a fair chunk of it, but realised that it's... not very good. Okay, it's my first "proper" C++ program, so that's no big deal, but I don't want to waste more time working...
7
9514
by: Tom | last post by:
I'm having a problem using a path with spaces as a parameter to os.rename() in a program on WinXP. This works fine at the command line (where the folder "c:\aa bb" exists) > os.rename( "c\aa bb", "c:\cc dd" ); > But, I can't get it to work in my program, eg.
3
6063
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an hierarchical view of Parent Nodes and projects where in a projectnode can be added to any ParentNode and hence we may have a project node added to 100 Parent nodes. In this one, I have an operation of Renaming a Project Node. So whenever I am doing the...
5
2758
by: jez123456 | last post by:
Hi, I’ve written a c# program to compact certain msaccess databases. The way this works is to compact say C:\test1.mdb to C:\temp.mdb, then delete C:\test1.mdb and rename C:\temp.mdb as C:\test1.mdb. My problem occurs if there is already a C:\temp.mdb file. I don’t want to just delete this, as it could have been created separately by a user. In my code, I set a constant as follows: private const string tempMdb = @"C:\temp.mdb";
3
1807
by: Erik Foreman | last post by:
I am using a folderbrowserdialog object to prowse to a folder then once in that folder I am going to have my program rename all of the files in that folder. I know the rename funchtion but I am not sure how to get the program to loop through each file in the folder so they all get renamed in a certian sequence. can someone help me? *** Sent via Developersdex http://www.developersdex.com ***
1
408
by: Wolfgang Meister | last post by:
Assume the current name of my project is "mytestroj". A couple of project files are named with this stem name like mytestproj.sln, mytestproj.suo, mytestproj.csproj,.... How can I rename my project to "testproj1" ? Is it sufficient just to rename all file in WindowsExplorer? Can I do this from within VisualStudio ? Wolfgang
5
2288
by: mythili123 | last post by:
The script will rename all files in the current directory whose names contain the first argument by replacing that part of the filename with the second argument. so far i could just get the file names that matches $ARGV.I need help on how to rename the files .For ex if argumnets are a bbb if a file name is rename.txt then O/P must be renbbbme.txt. #!/usr/bin/perl
2
1728
by: newyorker213 | last post by:
Hello, We have files ( named in the following format ) in one of our folders: MV0001.XLS MV0002.XLS and so on WV0001.XLS WV0002.XLS
1
5927
by: Alien | last post by:
Hi, I am new to PHP and trying to move a zip file from one directory to another. I researched on the web on this and all fingers pointed to this rename() function. I tried writing a PHP script which simply moves a zip file (located in the same directory as the source code) to another directory by: <?php $sourcecode = dirname(__FILE__).'\zipfile.zip'; //appending the current directory with the file name $destination =...
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.