SyntaxFix
Write A Post
Hire A Developer
Questions
Try putting double quotes in your filepath variable
"\"E:/ABC/SEM 2/testfiles/all.txt\""
Check the permissions of the file or in any case consider renaming the folder to remove the space