Copy folder and paste folder in same path

Hi,

1.I want to copy folder name as AUG - previous month and paste the folder in same path.
2.The pasted folder to be renamed as current month- SEP

could anyone help me out.

@Piraisoodan_J

Check as below

Mark as solution if this helps

Thanks

I used this code. My AUG file is moved and saved as SEP.
I want AUG file remains . To copy folder and rename as SEP

@Piraisoodan_J

Check as below

Hope this helps you

Thanks

I would recommend using ‘invoke method’ activity instead of using invoke code (you’d use the same CopyDirectory method)

2 Likes

Hi @Piraisoodan_J

Try using invoke powershell activity too which uses powershell code to copy folder
I tried it and it worked


Regards
Nived N
Happy Automation

1 Like

Hi, i have tried this. But in Sep folder is not copying items in AUG. SEP folder is empty

Hi @Piraisoodan_J,

Can you please explain a bit , do you want a copy of AUG Folder to be made as SEP folder and the files which are in AUG folder should be same in the SEP folder ?

Thanks,
Shikhar

yes exactly the same.what you said.

THE Folder AUG to be copied and renamed as SEP and paste in the same path.

ok @Piraisoodan_J,

in that case , if you want dynamic month, you can just, form your aug month path just take out the AUG month by using lastindexof as path comes in like this ‘c\newfolder\AUG’ so using last index of you can take out the month name , when you get the month name just increment it by 1 using globalization.cultureinfo package, then use create a directory activity in it pass the main path + the month created. the directory will be created . For the files uses Directory.getfiles in AUG folder in a for each loop and as soon as you get a file using copy file activity just copy it to the newly created SEP folder.

Thats it.

Thanks,
Shikhar

@Piraisoodan_J,

let me know if that helped for you

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.