Support Portal

for ProcessRobot and WinAutomation

Start a new topic

Rename a file with filename has a variable

I download files from an ftp but the files have a date and time stamp at the end of the file name.  I am trying to rename the file to get rid of the stamp.  for example:

Orders.01232019_20190124141800.csv  (original name)

Orders.*  ( i try to use this variable to find the file  to rename, but winautomation does not like it.


1 Comment

ADMIN

Hello there,


Please note that you could use the following.


  • Use the "Get Files in Folder" action to get a list with all the files in the specified folder.
  • Use a "For Each" loop to iterate through all the files in the previously created list.
  • Inside the loop, use the a conditional "If" action to check if the name of the file contains the word Orders (assuming that is the format of the files that you want to rename)
  • Inside the "If" action, place the "Rename File(s)" action.

image



In the above scenario you are getting all the files in the folder. This will allow you to use multiple "If" actions in the loop, to check for multiple file names. If you know that you will only be looking for files with a specific name, then you can get the files that match that specific file name. For instance, if you know that only want files with "Orders" in the file name, then you can specify the "File Filter" in the "Get Files in Folder" action's properties, to be

Orders.*
(the use of the wildcard character '*' is permitted here)

I hope the above makes sense.

Login or Signup to post a comment