Results 1 to 4 of 4

Thread: rename

  1. #1

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    hi,

    i would like to know a way through a button that i can rename a file to another name.

    e.g.

    system.ini to systemwin.ini, and also detect weather systemwin.ini is present if it is rename a different file

    thanks for any help, please could you include some code

    Cheers

    Merlin ?

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  2. #2
    Guest
    Code:
    Private Sub Command1_Click()
    Name "C:\Windows\System.ini" As "C:\Windows\Systemwin.ini"
    If Dir("C:\Windows\Systemwin.ini") <> "" Then
    Msgbox "File has been renamed!"
    Else
    Msgbox "An error has occured!", vbCritical, Error$
    End If

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        On Error GoTo errhandle:
        
        Dim sold As String, snew As String
        Dim sDir As String
        sDir = "C:\my documents\"
        
        sold = sDir & "mytext.txt"
        snew = sDir & "smynewfile.txt"
    'see if the new file name already exist
         If Dir(snew) <> "" Then MsgBox "File Exists Already"
         Name sold As snew
        
    errhandle:
        'if the file doesn't exist
          If Err.Number = 53 Then MsgBox "Sorry, file does not exist."
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    thanks guys that is just what i needed,

    Merlin ?

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

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