Problem with rename

here i got some problem with rename. This is the error shown when i try to rename.

![02|690x200]

This is my parameter.

(upload://lV914mxuNKgSVCeuzEx6v6ocGnJ.jpeg)

Is there anyone knw what is the mistake?

i already try to rename with another method also

This method can work when it separate from my workflow.But when i try to combine into my workflow, it cant work. Pls help me to solve this matter. Thanks

Hi @jiejie

I would humbly request you to choose a proper category for your post/topic when you create one.

In your case it would be mostly RPA dev rookies based on the pattern I have seen so for.

It would help us keep the forum topics well organized.

Thanks,
Prankur

2 Likes

Hi @jiejie,

Instead of Invoke Method you can use “Move File” activity and move this file to the same directory but with different name.

@srogo you mean form path use same name but to destination change the name?

@PrankurJoshi noted and thanks.

01

i get this error when i use move file.

my destination path is as this : “c:\Timesheet\TimesheetReport1” + valstart.ToString + valEnd.ToString +".xlsm "

what is the error?

1 Like

@jiejie
I think you’re missing one Backslash
here,

after TimesheetReport1,
it should like this "c:\Timesheet\TimesheetReport1\”

@samir even i put my destination file name like this : “c:\Timesheet"+valstart.ToString+valend.ToString+”.xlsm"

it show me error agian

03

You dont have that path,It should be “c:\Timesheet"+ valstart.tostring+valend.tosting+”.xlsm"
@jiejie

@jiejie
your destination path should ends with \
you’re missing that slash,

instead of this —>“C:\Timesheet”
put one slash(\) at the end of your path —>“C:\Timesheet\”

@sreekanth i already put as what u said

still same error @samir

@samir even i put the slash, still error

Can you try printing the two variables before this Move File activity, using message box or write line activity? Or run the workflow in debug mode to know the values of the variables at this instance.

Also note that while naming files, certain special characters are not allowed, like comma, slash, etc. Make sure your variables don’t contain any of these.

Continuing from

I believe you the two variables that you are trying to use are dates. Can you show me the format of the dates? If it has / it could be a problem.

@kaderms sorry for late reply. Before move file, i use message box and put variable inside and the result show like this. 01
02
Which this two variable are start date and end date.My variable dont have those.

and still show me the error:

@kaderms i get the date from csv file, and here is my workflow and format.

assign:

valStart = row(“Start Date”).ToString.Split(" “c)(0).ToString
valEnd = row(“End Date”).ToString.Split(” "c)(0).ToString

type into
valstart.ToString + " " + “00:00”
valEnd.ToString+ " " + “23:59”

*startdate and enddate i get from csv file.

Thanks.

File naming conventions in Windows doesn’t allow the below characters as a part of the file name.
So you will have to remove any of these special characters in your file name variables.

image

Also, can you share what is the actual file name of the source file that you are trying to move? Can you locate the file on disk and share the filename as it is saved on the disk?

1 Like

@kaderms i dint use those symbols…
It relate to what file i try to move/Rename? I havnt try in disk, i juz try in c file.

@kaderms i already solve this problem. i should replace / to - like this “c:\Timesheet\”+ valstart.Replace(“/”,“-”).Trim + valend.Replace(“/”,“-”).Trim +“.xlsm”

Thank you for helping :smiley: