Take a file, rename it and copy it to a new location

I am trying to get path of file txt, rename it in the date time format and copy the file to the new location. In my code
vplace = system.io.directory.getfiles(“path”) using this I am getting the path

Vplace is declared as string

When i am trying to copy, I am putting the from path as vplace.ToString

It is not working, I am getting the error "Source copy file
Message : Could not find file System String

1 Like

Use Copy File Activity

1 Like

Thanks for the reply

my file will be a downloaded one and name of the file will random so I want to extract the file name from the path and procced. In your I could see that the file name is already defined

Thanks for the reply

Can you pls provide the steps

Okay DO the following steps

  1. Files = Directory.GetFiles(<Required_Folder_Path>)
  2. Fore each FILE in Files
  3. Use Copy File activity Path= FILE & Destination= New_Folder_Path + Path.GetFileName(FILE)

It’s done!


Thanks, now it is working


thats cool.

How do we find our exact file and then copy this exact file to another location?
do we need if activity for it? how do we use it?

In this video I do a lot of stuff with Files (Chapter included) :

1:10 Download the file and Move the latest file to folders
4:30 Rename files with VB commands
6:00 Move files to do Rename
6:55 Delete files
8:15 Delete only PNG files
8:55 Delete all the files except PNG files
9:55 Move files
11:10 Delete files that are older than 2 weeks
14:40 Create a file or folder with dates inside

Cristian Negulescu