SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
renaming files and moving to a directory

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
renaming files and moving to a directory
Author Message
Dominic Klein



Joined: 23 Nov 2001
Posts: 132

Post renaming files and moving to a directory Reply with quote

Hello,
I can have any number of files in a directory but they will have a unique file extension - I want to rename the files to todays date and keep the original file extension and then move them to a backup folder.

eg file.DY1, file.DY2, file.DY3

Would all be renamed as DDMMYYYY.DY1, DDMMYYYY.DY2, DDMMYYYY.DY3 and then placed in my backup folder.
The problem I am having is renaming the files to be todays date and keeping the file extension. I can rename the files using the macro parameter OK to get todays date but I can't seem to be able to use a wildcard to keep the file extension.

Any ideas ?

Fri Jun 28, 2002 4:26 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: renaming files and moving to a directory Reply with quote

Here is the idea:

.Dim file_list, string
.Dim next_file, string
.Dim old_name, string
.Dim new_name, string
.Dim ext, string
.Dim is_empty, boolean
.
.Dir "your path here", file_list
.isEqual "", file_list, is_empty
.
.LoopUntil is_empty, END_OF_LOOP
. GetToken file_list, ",", next_file
. // calc full file name
. ConcatEx "old path...", "\\", next_file, old_name
. // split file name onto different parts
. GetToken next_file, ".", name_part
. // build new full file name
. Set ext, next_file
. ConcatEx "new path...", "\\@T"ddmmyyyy"DY.", ext, new_name
. // rename it
. FileRename old_name, new_name
.
. isEqual "", file_list, is_empty
.END_OF_LOOP:

: Hello,
: I can have any number of files in a directory but they will have a unique
: file extension - I want to rename the files to todays date and keep the
: original file extension and then move them to a backup folder.

: eg file.DY1, file.DY2, file.DY3

: Would all be renamed as DDMMYYYY.DY1, DDMMYYYY.DY2, DDMMYYYY.DY3 and then
: placed in my backup folder.
: The problem I am having is renaming the files to be todays date and keeping
: the file extension. I can rename the files using the macro parameter OK to
: get todays date but I can't seem to be able to use a wildcard to keep the
: file extension.

: Any ideas ?

Fri Jun 28, 2002 8:02 am View user's profile Send private message
Dominic Klein



Joined: 23 Nov 2001
Posts: 132

Post Re: renaming files and moving to a directory Reply with quote

after a bit of tweaking that seems to work thanks v. much

Fri Jun 28, 2002 11:51 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.