Renaming with wildcard

Hi, All

I’ve downloaded a file with “device” as a 1st word on it (e.g. devices_B_20191206T024257) I try to rename the file using the wildcard. see below.

Hi @rtablate

try to do with move file activity

Thanks
Ashwin S

Not working.

From - “C:\Users” + system.Environment.UserName + “\Downloads\device” + “*.csv”
To - “C:\Users” + system.Environment.UserName + “\Downloads\next.csv”

image

Hi @rtablate

are you able to print the filename within log message

Thanks
Ashwin S

You cant use wildcard like that.

A better solution would be to get the correct filename and store that in an argument.

You can use directory.getfiles to get all files within that folder - then look for the one that contains ‘device_’

then use that full file path to rename.

Hi @rtablate,

With in Excel scope use move file & save with customized name

filename is not accurate it may change depending on the time you’ve download the file so I’ve used the device* but it’s not getting me the correct filename. Can you please provide the details that you were saying? Thanks

So you can use directory.getfiles - file name will be whatever it is as you have downloaded it.

e.g. devices_B_20191206TXXXXXX

you can then look for that file - take the correct name
devices_B_20191206T024257 for example
and use that string as your input.