Renaming file

i have used rename file activity.
Do I need to mention extension type also while renaming
what if the sometimes if the original file is .xls or .csv

1 Like

Yes you have to put file extension.


Yes we need to specify extension type also.

Ya but some files might be of type .csv, .xlx, .xls all are excel sheets how to I know? It iso of which type

1 Like

from where you are getting files?

If you change file extension type then file will get renamed and corrupted.

those are downloaded files

ok I can get the file
example filename.nme_xxxx.yyyy.xlsx
tell the substring so that I can get only .xlsx

while mentioning the renamed file name
get the file extension from the file been passed as input (which is going to be renamed)
like this
out_extension = Split(in_filepath,".")(1).ToString
this will give us xlsx or csv or xls as a string

now with the rename property mention this at last like concatenating

simple isnt it
Cheers @KarthikBallary

So are saving it in any folder?

I mean last index (.) to …last position


1 Like

If you knows the full path of file then you can get the Extension using Path.GetExtension(“YourPath”).

1 Like

does it hold good if there any numbe rof “.” in filename?

thats a good question
usually we wont have . unless its before fileextension
if we do so , it will show error as illegal characters in file path
Cheers @KarthikBallary

Ya I mean the same is it going to last “.” we don’t have any dots after extension

1 Like

yah no dot after extension because thats the last one followed by fileextension
so split(instring,".")(1).ToString will surely give the file extension alone
Cheers @KarthikBallary

Split(in_filepath,".")(1).ToString whats “(1)” here? is it first index

1 Like

@KarthikBallary Try to use this.

1 Like

is returning ".xlx " or only “xlx”