Andi03 Posted January 6, 2004 Posted January 6, 2004 Hi. How do I rename files that I have in a dir? I can get the pathname and filename but I don't know how to rename the file without copying the file first. Any ideas? Quote
Administrators PlausiblyDamp Posted January 6, 2004 Administrators Posted January 6, 2004 system.IO.File.Move("old name","new name") Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Andi03 Posted January 6, 2004 Author Posted January 6, 2004 The name part, should that be only the filename with the extension or the whole filepath thing C:\filename.type? Quote
Administrators PlausiblyDamp Posted January 6, 2004 Administrators Posted January 6, 2004 Both name parts need to be the full path and filename of the file in question. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
be58d2003 Posted January 8, 2004 Posted January 8, 2004 system.IO.File.Move("old name","new name") Am I getting this right? He wants to rename a file from within his application... He uses this method? I am new, so all information helps. Quote Firefighters do it with a big hose...
*Experts* Bucky Posted January 8, 2004 *Experts* Posted January 8, 2004 If you pass the same directory to both parameters of the method, then sure, the file is being renamed. Think of it as being moved to a different place within the folder. This method can also move files do different directories, of course, but if you pass the same directory structure to both parameters, the method will simply rename the file. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.