Rename files in a folder and move them in a subfolder or another folder in a different drive

Continuing the discussion from Renaming bulky files and move to another folder:

Hi all,

I have been facing an issue at renaming and moving the files.
Scenario -

  • I have a folder named PDF which has only .pdf files
  • I want to replace “.pdf” with current date and after renaming, move all the files to a different folder which can be in a different drive or in a subfolder inside PDF folder.
  • I want to use for each loop and move file activity to get this done.
    image image

I have been facing challenges for the destination in move file activity. If I use newFileName inside destination, it replaces the file in the same folder but that’s not the objective. Is it possible to rename and move the files in different folder i.e. dstpath

I want to use newFileName variable in such a manner that filename is replaced by newFileName and newFileName also moves to dstpath. And it all should be done inside move file activity.

Any help !

@Tarun_Bajpai

If you don’t want to change in the source then keep another move activity and in the destination folder itself you can give newFileName and give the Same Destination folder

Hope this helps you

Thanks

I did not get it. Does it mean i have to use another move file activity and pass newFileName in the destination field ?

@Tarun_Bajpai

Yes

1st Move File - fileName → Destination
2nd Move File - FileName - Destination will be Destinationation with New FileName as below

image

In this way you can change the new FileName in the Destination only not on the Source

Mark as solution if this helps

Thanks

Hi @Tarun_Bajpai

Have a look to the below threads :-

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Hi @Srini84

Did you mean this?
image

Hi @Pratik_Wavhal

I wanted to use move file activity just once inside for loop. As you would have seen that objective is to replace filename with newFileName and move newFileName to another folder i.e. dstpath which stores the path of the destination. I was wondering if there is a possibility to use newFileName and dstpath in image .
If you could help, please do.
Thanks in advance :slight_smile:

Hello Tarun,
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
17:00 Trigger a process when the file is added to a folder
18:45 How to use the files start the process
20:30 Excel Application Scope use files

Thanks,
Cristian Negulescu