Lucky0906
(Cesar Cu)
January 11, 2017, 11:23pm
1
I am trying to insert the following senetence
file.move(oldpath,newpath)
But I don’t know which activity I must use because I tried to use “Assign” but It is shown a windows “Expresion does not produce a value”
Which activity Can I use to Move a file?
Is there a way to Rename a file?
I don’t see in the options the method “Rename” for a file
4 Likes
UdayKumar
(UdayKumar)
January 12, 2017, 4:24am
2
Hi Lucky
Please follow below steps
Activity Name :Invoke Method
Target Type : Microsoft.visualbasic.filesysytem
MehtodName :Rename
Go to Properties of Invoke method
Parameters:
Direction—Type-- -Value
-----In------- string – “OldFilename.txt”
-----In------- string – “NewFilename.txt”
Thanks
Udaykumar
10 Likes
There’s a MoveFile activity that does just that, no need for InvokeMethod.
For Renaming you “move” the file to the same folder, just with a different name.
As a sidenote - I’d recommend using System.IO.File type, method name Move instead of Ms.VB, since it doesn’t rely on VB specific implementation.
Regards.
16 Likes
Lucky0906
(Cesar Cu)
January 12, 2017, 3:55pm
4
Thanks!!
In fact, I did that, I hat to move the file to the same folder but renaming it
aksh1yadav
(AKSHAY YADAV)
January 12, 2017, 5:41pm
5
hey @Lucky0906
as @andrzej.kniola said
For Renaming you “move” the file to the same folder, just with a different name.
it will do what you wants.
To move a file from one destination to other destination with a different name then just rename the file when filling in the destination path
MoveFileWithRenameUsiNgMoveActivity.xaml (4.3 KB)
Regards…!!
12 Likes
The file name that I need to rename is not static. It changes daily.
How do I specify a wild card in the file name using the “Path” field in the “Move File” activity?
selrac
April 7, 2017, 11:12am
7
BoCoNdOn,
In a similar case I found it easier to create a MSDOS batch file to move files using wild cards. You need to use StartProcess activity to call the batch file with the MSDOS commands.
Hope it helps
vvaidya
(Vinay Vaidya)
April 7, 2017, 12:26pm
8
@BoCoNdOn What is the naming convention of your file?
you can always get the files by wildcard character using below logic
Directory.GetFiles("C:\Users\xyz\Desktop\files","DailyFile_*.txt") //DailyFile_040716.txt
1 Like
If you move a file or Rename a file you can use my software BatchRenameFiles Tool . It’s very easy to use .
Suchi3190
(Suchita Shaniware)
April 3, 2018, 7:22am
11
its giving error that filesystem dose not contain rename method.
karthick
(Karthick)
April 3, 2018, 7:37am
12
MoveFile Activity will help you in this .
Use the properties as below
From :- Path\Filename
Destination :- Path\RenamedFilename
2 Likes
yangbo
December 24, 2018, 5:15am
13
Hi Uipath angels,
Can I get a .xaml sample about how to handle case below?
The requirement is to find target file, change file name with not static string and move all of them to another folder.
The oringinal data is like following.
※※※In a word you can regard the first file name as title in each set, get the string between “~_00” and “.txt” and insert it into the place where “a,b,c,d,e,f,g” are.
20181202_HL00431_00_3837_000_000_name.txt
20181202_HL00431_01_a.txt
20181202_HL00431_02_b.txt
20181202_HL00441_00_3803_001_020_name1.txt
20181202_HL00441_01_c.txt
20181202_HL00441_02_d.txt
20181202_HL00555_00_3803_001_020_name1.txt
20181202_HL00555_01_e.txt
20181202_HL00555_02_f.txt
20181202_HL00555_03_g.txt
Hi,
Could you please advise how to move files with in FTP location
Hi @Ashwini_Kumaran what you can do is download the files from FTP server to your local server and then upload them to the location where you want them.
GCaldas
(GCaldas)
February 10, 2021, 9:46am
16
that is a very good solution
Veera_Raj
(Veera Raj)
March 12, 2022, 7:03pm
17
oldpath–sample\file.txt
new path–sample\newfilename.txt
in move file activity in destination give your file name with extension
in source give old path ,
regards,
veeraraj S
Hi,
You can use Rename File Activity and can rename the file also it saves in same folder.