I need to create a script that will rename a group of files with the same file extension, to the current date (mmddyyyy)plus a random string to make them unique. These files are on flash memory on a digital audio recorder, and I need to automate copying these files to a network share. (450 employees with recorders)I would like to include this in a Kix script I have that copies the files exactly the way I want, but I need to rename them because once a batch of files is copied to the network, the recorder starts reusing names and when I try to copy another batch on a later day, I might end up overwriting files. I thought I might just call a DOS batch file from the Kix script because I am more familier with BATs than I am with Kix, but what I have come up with doesn't work.
Code:
rename C:\test\*.txt %Date:~-10,2%%Date:~-7,2%%Date:~-4,4%_%random%.txt
This batch file just renames the first file in the directory every time I run it. It generates the date and the random string like I want it to, but then it tries to use that same date and random string to rename ALL the files and of course generates errors that a file with that name already exists. I would prefer it to be in Kix, but I can use shell to get to DOS if I have to. I read Jooel's post in the UDF library forum called "Rename() - rename file or folder" but I don't get it at all. It seems very complex and I am just a newbie at this stuff. I have ordered a copy of the guide to scripting by Bob Kelly, but it has not arrived yet and I am lost...
Any help would be appreciated. Thanks