1,105,585 Community Members

Copy File using file name concept

Member Avatar
tashee2007
Newbie Poster
23 posts since Dec 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello,

I would like to seek help from all experts in VB.NET (VB Language) regarding copying file from source folder to destination folder.

I have a files named YYYYMMDDHHMMSS.txt. Now i want to build a small project to copy those file to destination folder. The project should work in following manner:

  1. Check Computer Date
  2. Look for the file in destination folder similar to computer date and then copy that file to destination folder. For example:
    Let say Computer Date is 26/12/2012. When the program starts, it should check the computer date and then look for the file named 20121226*.txt. If the file is present then it should start copying else it should give a message saying the file does not exists.
  3. It should create log file storing the copy information.

Can any one help me how to have above feature in my project.

Thanks

Member Avatar
Pgmer
Practically a Posting Shark
881 posts since Apr 2008
Reputation Points: 50 [?]
Q&As Helped to Solve: 158 [?]
Skill Endorsements: 3 [?]
Featured
 
0
 

Till now how far you wrote code for this? You want someone to write code for you?

Member Avatar
TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418 [?]
Q&As Helped to Solve: 152 [?]
Skill Endorsements: 16 [?]
 
0
 

That is not a question, that is a specification. As stated above, show what you have tried and described what is giving you problems.

Member Avatar
tinstaafl
Postaholic
2,012 posts since Jun 2010
Reputation Points: 559 [?]
Q&As Helped to Solve: 403 [?]
Skill Endorsements: 36 [?]
 
0
 

try these articles as a starting point:
Click Here
Click Here

Member Avatar
ObSys
Junior Poster
136 posts since Nov 2011
Reputation Points: 56 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 1 [?]
 
0
 

For the date use the Date.Today() function.

To take the date from the format dd/mm/yyyy and put it in the form ddmmyyyy you will need to build a new string like this Date.Today.Day & Date.Today.Month & Date.Today.Year

To check if a file exists you need to use the System.IO.File.Exists(path) function

Hope this helps. Should be enough to complete your task

Member Avatar
Reverend Jim
Noli mentula
5,457 posts since Aug 2010
Reputation Points: 761 [?]
Q&As Helped to Solve: 653 [?]
Skill Endorsements: 51 [?]
Moderator
Featured
 
0
 

Simpler way is

Date.Today.ToString("yyyyMMdd")
Member Avatar
tashee2007
Newbie Poster
23 posts since Dec 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks Experts for the help. I got the answer.

Question Answered as of 1 Year Ago by ObSys, TnTinMN, Pgmer and 2 others
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article