cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chaile90
Frequent Visitor

rename file using the same data in the filename to another format

Hi Dear,

 

There is probably a similar thread to this, but I need someone to explain this to me in simple terms as I am a total beginner when it comes to this.

 

I'm developing an automation to extract files on the web. The problem is that the name appears in the following format "08-04-2021 06.01.00-DAY001 Report", I want to change the name after downloading it to Report_Day_20210804. Can you help me? I need to convert the date that appears in the name to 20210804 format

 

Regards

Valter

1 ACCEPTED SOLUTION

Accepted Solutions
yasunm02
Solution Sage
Solution Sage

In simple terms you can do this:

a) Retrieve the file's name

b) Get the day, month and year as variables

c) Concatenate day, month and year variables into the new name you want

d) Rename the excel file.

 

Considering you'll download your file to a specific folder, this flow will work (actions, key parameters):

1. 'Get files in folder', Folder = where your file is. This will give you a %Files% variable

2. 'Get subtext':

  • Original text = %Files[0].Name%
  • Start index = Start of text
  • Lenght = Num of chars
  • Number of chars = 2

Rename the produced variable as %Month%

3. 'Get subtext':

  • Original text = %Files[0].Name%
  • Start index =Character position
  • Character position = 3
  • Lenght = num of chars
  • Num of chars = 2

Rename the produced variable as %Day%

4. 'Get subtext':

  • Original text = %Files[0].Name%
  • Start index =Character position
  • Character position = 6
  • Lenght = num of chars
  • Num of chars = 2

Rename the produced variable as %Year%

5. 'Set variable', Define = Newname, To = Report_Day_%Year%%Month%%Day%

6. 'Rename file':

  • File to rename = %Files[0]%
  • Rename scheme = Set new name
  • New file name = %NewName%
  • Keep extension = activated

View solution in original post

2 REPLIES 2
yasunm02
Solution Sage
Solution Sage

In simple terms you can do this:

a) Retrieve the file's name

b) Get the day, month and year as variables

c) Concatenate day, month and year variables into the new name you want

d) Rename the excel file.

 

Considering you'll download your file to a specific folder, this flow will work (actions, key parameters):

1. 'Get files in folder', Folder = where your file is. This will give you a %Files% variable

2. 'Get subtext':

  • Original text = %Files[0].Name%
  • Start index = Start of text
  • Lenght = Num of chars
  • Number of chars = 2

Rename the produced variable as %Month%

3. 'Get subtext':

  • Original text = %Files[0].Name%
  • Start index =Character position
  • Character position = 3
  • Lenght = num of chars
  • Num of chars = 2

Rename the produced variable as %Day%

4. 'Get subtext':

  • Original text = %Files[0].Name%
  • Start index =Character position
  • Character position = 6
  • Lenght = num of chars
  • Num of chars = 2

Rename the produced variable as %Year%

5. 'Set variable', Define = Newname, To = Report_Day_%Year%%Month%%Day%

6. 'Rename file':

  • File to rename = %Files[0]%
  • Rename scheme = Set new name
  • New file name = %NewName%
  • Keep extension = activated
Chaile90
Frequent Visitor

You are a genius @yasunm02 

 

Many thanks for help. Working perfect...

 

Best wishes and a good weekend 🙂

Valter

 

Helpful resources

Users online (4,092)