Add Date to file name - VisualCron - Forum

Community forum

bjoern
2021-03-03T14:53:52Z
Hi@all,

i try to rename some files in a folder.

Now I want do add the current date/time at the beginning of each file. To do this, I created a "list file" + "rename file" loop. In the new name mask:
{PATH(GetFileNameWithoutExtension)}_{LOOP(CurrentValueX)}_{DATEFORMAT(yyyy_MM_dd)}{PATH(GetExtension)}

Example: c:\temp\
fileXXX.abc --> fileXXX_COUNTER_YYYY_MM_DD.abc
fileXX1.abc --> fileXX1_COUNTER_YYYY_MM_DD.abc
file_MORE_XXX.abc --> file_MORE_XXX_COUNTER_YYYY_MM_DD.abc

The result for the new name are:
Error in argument_1_2021_03_03Error in argument
Error in argument_2_2021_03_03Error in argument
Error in argument_3_2021_03_03Error in argument

It look like, that {PATH(GetFileNameWithoutExtension)} and {PATH(GetExtension)} not working - what do i wrong?

Thanks
Bjoern





thomas
2021-03-03T15:51:36Z
You need to pass in the file to the funtions, like in the picture below. Have alook in the variables window and it should become clearer hopefully

image.png
bjoern
2021-03-03T16:50:16Z
thanks thomas,

but it not real clear for me. I thought, the "list files" will fill the variable with content automatically - isnt it? so, what should i do to give the result (the filename) to the rename task and rename the file including the old file name? for example: {LOOP(CurrentValueX)}_{DATEFORMAT(yyyy_MM_dd)}
works, with the result
Old names:
FileNameUnkown1234.txt
FileName2345_Unkown1234.txt
ABC-4567_FileNameUnkown1234.txt

New:
1_2021_03_03,
2_2021_03_03
3_2021_03_03


I can use {LOOP(CurrentValueX)}_{DATEFORMAT(yyyy_MM_dd)}_{PATH(GetFileName|C:\Program Files (x86)\VisualCron\VisualCronClient.exe)}
but i dont wont:
1_2021_03_03_VisualCronClient.exe
2_2021_03_03_VisualCronClient.exe
3_2021_03_03_VisualCronClient.exe

:-)

but i need the old file name included the new name.
{LOOP(CurrentValueX)}_{DATEFORMAT(yyyy_MM_dd)}_{PATH(GetFileName|c:\kwon-path\But_I_Dont_Know_The_Name_Of_File.txt)}

1_2021_03_03_FileNameUnkown1234.txt
2_2021_03_03_FileName2345_Unkown1234.txt
3_2021_03_03_ABC-4567_FileNameUnkown1234.txt

Thanks
Bjoern


Support
2021-03-08T12:10:00Z
Originally Posted by: bjoern 

Hi@all,

i try to rename some files in a folder.

Now I want do add the current date/time at the beginning of each file. To do this, I created a "list file" + "rename file" loop. In the new name mask:
{PATH(GetFileNameWithoutExtension)}_{LOOP(CurrentValueX)}_{DATEFORMAT(yyyy_MM_dd)}{PATH(GetExtension)}

Example: c:\temp\
fileXXX.abc --> fileXXX_COUNTER_YYYY_MM_DD.abc
fileXX1.abc --> fileXX1_COUNTER_YYYY_MM_DD.abc
file_MORE_XXX.abc --> file_MORE_XXX_COUNTER_YYYY_MM_DD.abc

The result for the new name are:
Error in argument_1_2021_03_03Error in argument
Error in argument_2_2021_03_03Error in argument
Error in argument_3_2021_03_03Error in argument

It look like, that {PATH(GetFileNameWithoutExtension)} and {PATH(GetExtension)} not working - what do i wrong?

Thanks
Bjoern







Hi Bjoern,

Please attach the job (as simple as possible, just the list files and copy/rename task preferrably) and the instructions of how you want it to look exactly, in an email to support@visualcron.com so we can get a better overview as to how to optimize it and make it work for you.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top