Hi Team,
I want to see file size for that i am using below expression
but i am getting below error,
Please help me on this issue.
Hi Team,
I want to see file size for that i am using below expression
but i am getting below error,
Please help me on this issue.
→ Use the Get File info activity to get the information of the file. Give the path of the file in the File Path field and Create a variable in the Output to field, let’s call the variable name as FileInfo.
→ Then use the below Expression to get the file size in KB.
FileInfo.SizeInKB
Check the below image for better understanding,
Hope it helps!!
Thanks for your response…
I am getting below error after using your expression…
I have changed could you recheck the above reply by using Get file info activity… @Smitesh_Aher2
How to get size in mb?
Hello @Smitesh_Aher2 , Try below expression to get the file memory size in kb
(New System.IO.FileInfo("C:\Users\1122\Downloads\Sample.pdf").Length / 1024).ToString()
New System.IO.FileInfo("C:\Users\1122\Downloads\Sample.pdf").SizeInKB
Try this
(New System.IO.FileInfo("C:\Users\1122\Downloads\Sample.pdf").SizeInKB / 1024)
((New System.IO.FileInfo("C:\Users\1122\Downloads\Sample.pdf").Length / 1024)/1024).ToString()
Okay simply you can divide it by 1000,
Cdbl(FileInfo.SizeInKB/1000)
To get in KB,
FileInfo.SizeInKB
To get in MB,
Cdbl(FileInfo.SizeInKB/1000)
Hope it helps!!
Thanks @mkankatala & @Gokul_Jayakumar Expressions are working as expected.
But when i am trying to divide like (First_file_size/second_file_size = 8.98/5) getting below error
How to resolve this issue?
Then you have to convert the double to string.
(Cdbl(FirstFileSize/SecondFileSize)).toString
Hope you understand!!
Not working.
I have taken FirstFileSize variable type as String and SecondFileSize variable type as Int.
The SecondFileSize value is fixed as 10 & only FirstFileSize is not fix so we have to calculate it by expression.
After using as above getting below error
Which variable type should i use?
Okay @Smitesh_Aher2
→ Take an assign activity and store the 10 in a SecondFileSize variable which is in Int32 datatype.
→ Store the First File Size in MB in FirstFileSize Variable which is in String datatype.
→ Use the below expression to divide the First file size and second file size to get the output in String datatype.
(Cdbl(FirstFilesize)/Cdbl(SecondFilesize)).toString
Hope you understand!!
Thank You so much @mkankatala it’s working as expected.
Just i have question below,
I am getting value in the decimal format as 2.3456 then how to print value as round figure.
For eg:-1) 2.3445 = 2
2) 2.5878 = 3
Is there any expression for to get value like this?
Okay use the below one,
(Math.Round(CDbl(FirstFileSize)/CDbl(SecondFilesize))).ToString
I hope you find the solution for your query, Make my post Mark as solution to close the loop.
Happy Automation!!
Thanks once again @mkankatala
It’s my pleasure… @Smitesh_Aher2
Happy Automation!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.