Hi All Dev,
I have the problem regarding move files and rename.
I have use activities as below.
1 Assign
files = Directory.GetFiles(“path folders”) * files is string
date_stamp = System.DateTime.Now.ToString
2 for each * type Argument is string
s_files in files
3 Move file
form path s_files
to destination Destination+date_stamp+“.PDF” but not working
sample i have PDF many files in folder.
before move to destination folders
20190724_9077157489.PDF
20190724_9077157493.PDF
20190724_9077157495.PDF
Expected after moved
20190724_9077157489 24-09-2019 11:22:33.PDF
20190724_9077157493 24-09-2019 11:22:33.PDF
20190724_9077157495 24-09-2019 11:22:33.PDF
Thank you for advance.
lakshman
(Ganta lakshman)
September 24, 2019, 5:05am
2
@pjaiphak
We can’t use special characters colon : into filenames and it will give error. Instead of colon use some other character.
@lakshman
Thank you very much.
but i have new issue.
assign
System.DateTime.Now.ToString(“dd-mm-yyyy hh-mm-ss”)
Destination+d_stamp+“.PDF”
Have you reset the files after moving it? Meaning it must have been already moved, so you need to copy them back with the original names…
@Raghavendraprasad
Correct after moved i need reset files name and include date time.
HareeshMR
(Hareesh Madasi)
September 24, 2019, 6:27am
6
As per the screenshot above, you are missing the file extension I guess
Hi @HareeshMR Could you please help advise.
HareeshMR
(Hareesh Madasi)
September 24, 2019, 6:34am
8
Can you post the destination file name which you are providing for move file activity @pjaiphak ?
@HareeshMR please see as below.
From path
files=Directory.GetFiles(“D:\ALL_RPA\BDF_Auto_Print_INV\Main_INV\BDF_INV”)
s_files = files
Destination=“D:\ALL_RPA\BDF_Auto_Print_INV\Main_INV\BDF_INV_ARC"
Destination+d_stamp+”.PDF"
HareeshMR
(Hareesh Madasi)
September 24, 2019, 6:49am
10
yeah , you need to add a back slash (\) after the destination and the timestamp variable it seems
check the destination path once
Hi @HareeshMR
after retest
before move i have 3 files.
20190724_9077157489.PDF
20190724_9077157493.PDF
20190724_9077157495.PDF
after moved
24-05-2019 02-05-42.PDF
Expected
20190724_9077157495 24-05-2019 02-05-42.PDF
can’t get current file name but replace name with d_stamp. -__-"
HareeshMR
(Hareesh Madasi)
September 24, 2019, 10:42am
12
So, you want to append the date and timestamp along with the previous name right?
Then do the following,
You are getting the item which is full path,
Use string manipulations to get the existing file name without extension
Then assign the value to a new string which contains both values, like the previous value you got in step 2 and the date time stamp
Then use it in the move file activity
Hi @HareeshMR
Thank you for advice. but i’m very young beginner for UiPath developer.
Can you guide line for use activities 1-4. i will adapt or apply to complete workflow.
Thanks.
Hi @HareeshMR
Very Excellent. I have completed this work flow. Thank you very much for you help.
system
(system)
Closed
September 30, 2019, 7:52am
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.