Hi guys,
i couldnt get my move file to my directory may i know why ?
FilesfromDir=Directory.GetFiles("C:\Users" + System.Environment.UserName + "\Downloads")
FilesFromDir i set as String
then in my for each
File in FilesFromDir
i list a if condition to set that
FilesfromDir.Contains(“example.xlsx”) etc which i have mutlple of and i use the and/or condition
then in my move file i write something like this
am i doing something wrong ?? cos my move file didnt move my excel file to the file path i wanted
Yoichi
(Yoichi)
June 1, 2023, 3:46am
2
Hi,
I think this should be as the following. (Please add backslash after C:\Users
Directory.GetFiles("C:\Users\" + System.Environment.UserName + "\Downloads")
Or the following might be better to prevent this error.
Directory.GetFiles(System.IO.Path.Combine("C:\Users",System.Environment.UserName,"Downloads"))
Regards,
I have try change my directory file however my move file still don’t move my multiple excel file
Srini84
(Srinivas)
June 1, 2023, 4:08am
4
@xxGoRpa
Check the filepath for the File.ToString
Usually in FilesfromDir it shouldbe Directory.GetFiles("C:\Users\" + System.Environment.UserName+ "\Downloads")
above \ is missing, can you check and let us know
Thanks,
Srini
Directory.GetFiles("C:\Users" + System.Environment.UserName + “\Downloads”)
yes i have check i am using it
"Users\ "
Srini84
(Srinivas)
June 1, 2023, 4:13am
6
@xxGoRpa
Okay then you can write the condition as below
Path.GetFileName(File) = “User Maintainance Report.xlsx” OR you can put your next logic same as the one which we declare
If this is also not working then you have to debug and check where it is getting issue
Thanks,
Srini
I am getting this ? in my if condition
Srini84
(Srinivas)
June 1, 2023, 4:25am
8
@xxGoRpa
For Each you can check the properties as TypeArgument and change that Object to String
If you are not able to find the TypeArgument then write as Path.GetFileName(File).Tostring = your value
Thanks,
Srini
i have try this however i still cant move in with 1 file …
Srini84
(Srinivas)
June 1, 2023, 5:16am
10
@xxGoRpa
You have place .ToUpper to the String and you are trying contains again which is making no sense
Try as File.ToString.ToLower.Contains("similar itqs issued report.xlsx)
Hope this may help you
Thanks,
Srini
I have try however my file still does not moved to the destination folder …
Srini84
(Srinivas)
June 1, 2023, 5:39am
12
@xxGoRpa
.Tolower will convert all the values to a lower case, and you are comparing with Similiar ITQs which always make false
You have put all in lower case and try as similar itqs issued report.xlsx
Thanks,
Srini
Thanks it work now after uppercase all need to upper or lower need to be smaller … LOL
Srini84
(Srinivas)
June 1, 2023, 5:43am
14
@xxGoRpa
That’s nice, Glad it helped for you
Please click Mark as solution for appropriate post
So that others can benefit
Thanks,
Srini
system
(system)
Closed
June 4, 2023, 5:44am
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.