|
|
|||||||
Hi... Is there anyway I can use KIX to rename a file from for example LOG to LOG-[DATE]-[TIME]? For example by using @Date and @Time? |
||||||||
|
|
|||||||
Hi alothe: Should be something like this. Code:
|
||||||||
|
|
|||||||
good code snippet but please don't use it. just do simply: Code: move "c:\someWild\myfile.ext" "c:\someWild\myfile_"+@year+@monthno+@mdayno+".ext" in english, jose... we do have move, you know? thus, no need for shelling. |
||||||||
|
|
|||||||
BTW...In order to work ok with file formats ( '/' or ':' not allowed FE) you can try Jooel UDF too.. Code:
|
||||||||
|
|
|||||||
Good one DOC, maybe I did the hard one. |
||||||||
|
|
|||||||
doc? what is "jooel UDF"? dude... have you passed over, again? |
||||||||
|
|
|||||||
Thanks for your help. Im pretty new to Kix... so I have some problems fuguring out the different syntaxes. I like to think Im getting a hang of it. I tried both your methods, and the both worked perfectly. I then tried jamming a @TIME macro after your "@YEAR-@MonthNo-@MDayNo", so it reads "@YEAR-@MonthNo-@MDayNo-@TIME", but this creates the error message: "A duplicate file name exists, or the file cannot be found." I verified that the file Im trying to rename is in the dir, and that there is no file with the NEW name, but still the error occurs... Any ideas? I think I'll steer clear of the UDF for now... I like to understand whats going on before it gets to advanced... baby-steps, you know? :-) and, thanks for bearing with me... |
||||||||
|
|
|||||||
@time contains several ":" which are afaik illegal in filenames |
||||||||
|
|
|||||||
Aha alothe....taking Joch tip you can take a look above at Replace() function, there I replace ':' illegal with '-' of @time. BTW....Lonkero I thought Replace() was yours. Pardon pardon. |
||||||||
|
|
|||||||
and still, jose, I'm not DOC. and, no... replace function should not be used with any kix version above 4.10 which introduced join() now you can replace anything with simple join-split: Code: join(split(@time,":"),"") ? ;replaces all the occurances of ":" in @time with "" like you see, it's a simple task, replacing that is and thus I never wrote UDF for that. there is no use. |
||||||||
|
|
|||||||
Its nice to be punished by a mod every now and then I kinda missed that feeling. |
||||||||
|
|
|||||||
To be honest Jooel Nieminen.....the avatar confused me thinking that you where DOC. Am I getting old? |
||||||||
|
|
|||||||
Jooel... is this what you didn't write? or are you talking about some other UDF? |
||||||||
|
|
|||||||
lol true Allen!! I will have to edit the above post again....I shoudnt pay that much of attention to some basta. |
||||||||
|
|
|||||||
ja! allen, I was not sure did I do it or not, so I decided to say I didn't. indeed, I wrote that udf to show that the other one was really an overkill. |