Results 1 to 6 of 6

Thread: Renaming Files [Resolved]

  1. #1

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Renaming Files [Resolved]

    Dont really ask questions here . Just being lazy today so here it goes.

    How can I Rename a file in VB6 using either Name function, API or FSO?

    Befor you answer here is my requirements.

    I know how to rename a file, but I have a slightly different requirement then just renaming file.

    I have a lot of files Capitalised, now i need ot rename them with proper casing. I have developed a batch renamer, but the problem is i Can not rename file if I have not changed the file name. Let me give you an example.

    Say my orginal file name is.

    C:\MY FILE\HELLO THERE HOW ARE YOU\MY FILE 1.TEXT

    NOW I want to rename it to

    C:\My File\Hello There How Are You\My File 1.txt

    Now as you can see the two file path are same so i cant use VB6's Name function nor the CopyFile of FSO. I can temporarily move it to some where rename and copy it to the original folder but that would not be efficient since i have hundred/thousnds of file to rename.

    So is there any alternative? API solution is fine, all i need is the API name or function name.

    Thanks.
    Last edited by Danial; Sep 6th, 2004 at 04:30 PM.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  2. #2

  3. #3

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by MartinLiss
    VB Code:
    1. Name oldname As newname
    Martin, that wont work, since my OldName and NewName are same.

    Even in .Net the situation is same, the two parameter must not be the same .

    Thanks for your reply though.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4

  5. #5

  6. #6

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by MartinLiss
    Well in your example the names are not the same (TEXT vs. txt) but it doesn't matter. At least on XP you can change xxx.txt to XXX.TXT.
    Thanks Martin, you are right, I was getting error saying "File already exist", after your post I checked it it was not due to the "Name" function rather my function was generating another duplicate file. Thats where the error came from and i assumed it was from "Name".



    Thanks again.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width