Jump to content
Sign in to follow this  

Naming a file using variables

Recommended Posts



Does anyone know of a way to use either system variables or hard coded constants to generate file names.

What I am trying to do is to copy some information from a PC and then rename the file based upon the above criteria.

I have my script collecting the data and writing it to a file but I don't have the renaming part correct.

Any thoughts or ideas would be helpful.

Share this post

Link to post
Share on other sites

I am creating a file called data.rdm.

I want to take a constant such as a "99" + the file name + the current date and rename the file so that data.rdm now looks like 99data071510.rdm.

I am very new to this so I am not sure how to get this done in a single pass, if possible.

I've written my first project and all parts of the project works fine, this is a new feature that will help identify the source and I don't know how to get this done.

Your help and comments are appreciated.

Share this post

Link to post
Share on other sites

$sNewName = $number & $oldfilename & $date & $extension

$number = 99

$oldfilename = "data"

$date = 071510

$Extension = ".rdm"

you could get really fancy and make the date get the actual date. :blink:

$date = @MDAY & @MON & @YEAR

Throw in a while to make your $number count up or down.

Edited by Kaeft

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.