Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 14, 2012 09:49 PM by Maikol
Member
102 Points
82 Posts
Feb 14, 2012 06:52 PM|LINK
I neet to move a fiel from a directory to other.
But I am getting the following error:
Could not find a part of the path
This is my code:
Dim fi As FileInfo = New FileInfo("/2012/february/doc.pdf") fi.MoveTo("/2012/april/doc.pdf")
Star
13877 Points
2598 Posts
Feb 14, 2012 07:11 PM|LINK
Guessing you need to do something like:
Dim fi As FileInfo = New FileInfo(Server.MapPath("~/2012/february/doc.pdf"))
Contributor
5925 Points
1115 Posts
Dim fi As FileInfo = New FileInfo(Server.MapPath("/2012/february/doc.pdf")) fi.MoveTo(Server.MapPath("/2012/april/doc.pdf"))
Feb 14, 2012 09:49 PM|LINK
The right way is with the simbol ~ like this:
Dim fi As FileInfo = New FileInfo(Server.MapPath("~/2012/february/doc.pdf")) fi.CopyTo(Server.MapPath("~/2012/april/doc.pdf"))
Thank you!!!
Maikol
Member
102 Points
82 Posts
Could not find a part of the path + Moving files
Feb 14, 2012 06:52 PM|LINK
I neet to move a fiel from a directory to other.
But I am getting the following error:
Could not find a part of the path
This is my code:
Dim fi As FileInfo = New FileInfo("/2012/february/doc.pdf") fi.MoveTo("/2012/april/doc.pdf")b471code3
Star
13877 Points
2598 Posts
Re: Could not find a part of the path + Moving files
Feb 14, 2012 07:11 PM|LINK
Guessing you need to do something like:
Dim fi As FileInfo = New FileInfo(Server.MapPath("~/2012/february/doc.pdf"))niksv
Contributor
5925 Points
1115 Posts
Re: Could not find a part of the path + Moving files
Feb 14, 2012 07:11 PM|LINK
Dim fi As FileInfo = New FileInfo(Server.MapPath("/2012/february/doc.pdf")) fi.MoveTo(Server.MapPath("/2012/april/doc.pdf"))Maikol
Member
102 Points
82 Posts
Re: Could not find a part of the path + Moving files
Feb 14, 2012 09:49 PM|LINK
The right way is with the simbol ~ like this:
Dim fi As FileInfo = New FileInfo(Server.MapPath("~/2012/february/doc.pdf")) fi.CopyTo(Server.MapPath("~/2012/april/doc.pdf"))Thank you!!!