Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

SaveAs files and directory inder the application path

saveas

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 selfcode

selfcode

    CC Lurker

  • New Member
  • Pip
  • 3 posts

Posted 19 June 2015 - 12:29 AM

Dears,

 

Can anyone help me on how to SaveAs the following (in C# or VB.Net):

MyProject.DAT
MyProject (directory)
----MyProject_1.CSV
----MyProject_2.CSV
----MyProject_b1.CSV
----MyProject_b2.CSV
----..
----MyProject_n.CSV

To a different name say 'MyProject2' as the following:

MyProject2.DAT
MyProject2 (directory)
----MyProject2_1.CSV
----MyProject2_2.CSV
----MyProject2_b1.CSV
----MyProject2_b2.CSV
----..
----MyProject2_n.CSV

As you can see, the main file (*.DAT) and the corresponding directory as well as the files under the directory (*.CSV) have the same string name: initially 'MyProject'; and 'MyProject2' if the user SaveAs to 'MyProject2'.  I would like to maintain the original files (before they are SaveAs')

 

Thank you so much for your help



#2 selfcode

selfcode

    CC Lurker

  • New Member
  • Pip
  • 3 posts

Posted 19 June 2015 - 04:03 AM

I amaged to change the main file *.DAT, from MyProject.DAT to MyProject2.DAT with 

System.IO.File.Copy(oldName, newName)

I have also managed to create a new folder MyProject2 and move the original files to it.  But I am unable to rename these files corresponding to the new file name.

 

Any help please?






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download