Click here to Skip to main content
14,733,513 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
My c# console application reads data from a excelsheet which is located at C:\Data and my c# console app can be installed in any directory in the system and my requirement is to move the excelsheet to the same location as my c# console application,so that means i won't be providing path specificly to move the excelsheet and i wan't to know how to specify the path in File.Move() or the code so that whereever my app will be installed the excelsheet should go there after it is processed.
Posted
Updated 15-Dec-13 20:45pm
v2
Comments
Eduard Keilholz 24-Sep-13 17:08pm
   
Erhm, you question is pretty unclear. Do you want to move the file to the location where your app is installed?

Since Windows Vista there are a couple of 'rules' you need to know before transferring files on a windows machine from one to another location. Thing is a mechanism called UAC will bother you.

There are a couple of locations you can access files, and a couple of locations that will surely throw an exception and deny your file copy/move/delete command unless your application is running with elevated permissions.

So as stated in my comments I still don't really understand your question, but I've seen enough to give you at least this warning.

Cheers!
Eduard
   
Move Excel file from C:\Data\ to executable folder ;)

For further information, please, see: Application Startup and Executable Path[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900