Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Time Date Renamer VBS

  • 20-12-2002 12:33pm
    #1
    Closed Accounts Posts: 539 ✭✭✭


    Hello,

    Can you help?

    I'm looking for a small vb script that can copy a file eg. file.txt and rename it to the current date and time, time should include seconds so it should look like this then 20122002103023

    I'm not a programmer but usually can modify many scripts to do what I wish, unfortunately this is giving me a headache. Any help appreciated.

    Yurma


Comments

  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Like this?
    Function setFilename()
    	Dim sFileneame
    
    	sFileneame = Day(Now())
    	sFileneame = sFileneame & setSize(Month(Now()))
    	sFileneame = sFileneame & setSize(Hour(Now()))
    	sFileneame = sFileneame & Year(Now())
    	sFileneame = sFileneame & setSize(Hour(Now()))
    	sFileneame = sFileneame & setSize(Minute(Now()))
    	sFileneame = sFileneame & setSize(Second(Now()))
    
    	setFilename = sFileneame
    End Function
    
    Function setSize(iNumber)
    	If Len(iNumber) = 1 Then
    		setSize = "0" & iNumber
    	Else
    		setSize = iNumber
    	End If
    End Function
    
    MsgBox setFilename
    
    I would do that in Year, Month, Day, Hour, Minute, Second order, btw.


  • Closed Accounts Posts: 539 ✭✭✭Yurmasyurda


    Something similar, it's kind of working now but I have a headache so resting :)

    Thanks ;)


Advertisement