We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,417 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Copy File using file name concept

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

6
Contributors
6
Replies
1 Month
Discussion Span
3 Months Ago
Last Updated
7
Views
Question
Answered
tashee2007
Newbie Poster
21 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

Pgmer
Practically a Posting Shark
881 posts since Apr 2008
Reputation Points: 60
Solved Threads: 158
Skill Endorsements: 1

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

TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418
Solved Threads: 148
Skill Endorsements: 13

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

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

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

ObSys
Junior Poster in Training
77 posts since Nov 2011
Reputation Points: 24
Solved Threads: 7
Skill Endorsements: 0

Simpler way is

Date.Today.ToString("yyyyMMdd")
Reverend Jim
Carpe per diem
Moderator
3,623 posts since Aug 2010
Reputation Points: 563
Solved Threads: 452
Skill Endorsements: 32

Thanks Experts for the help. I got the answer.

tashee2007
Newbie Poster
21 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 3 Months Ago by Pgmer, tinstaafl, Reverend Jim and 2 others

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0912 seconds using 2.72MB