copy just new files from directory to directory

barakkadosh

New member
Joined
Sep 1, 2020
Messages
2
Programming Experience
Beginner
hii
i want to know how to copy new files from folder to folder
i have some app that create every day some files
i want to backup this files in other folder
i want to copy just the new files from this folder
how can i do it in c#
 
One reason that beginners find it hard to solve problems is that they don't break down the bigger problem in front of them into smaller parts to determine which part is actually at issue. It's a skill that people develop over time but the sooner you can start doing so the better, so here's your chance to start doing that. Your problem is actually three separate problems:
  1. How to get all the files in a folder.
  2. How to determine whether a file is new, i.e. was created after a particular date/time.
  3. How to copy a file.
All three of those is completely independent. The fact that you're doing all three together doesn't mean that they could each be used on their own in another app. As such, you should be researching and implementing each one separately. If you search for how to copy new files between folders then you're unlikely to find too many results. If you search for each of those three elementary tasks in isolation, you're likely to get results for all three, so you can implement all three. Once you can implement each task, you can put them all together to solve the overall problem. You shouldn't really need help with the individual tasks but you may need help with the integration of the solutions. See how you go.
 
To take things a step further, step 2 above is itself two other tasks combined:

2a. How to determine when a file was created.
2b. How to determine if a date/time is greater than another date/time.

This is how you should solve all your problems, i.e. keep breaking it down into smaller and smaller parts and address each part separately, using existing knowledge where you can and researching very specific topics where you must. You can then ask very specific questions about the particular parts that you can't find information on or that don't work the way you expect. Until you have identified the constituent parts, researched each and attempted to implement those you have or can find information for, you don't actually know what you can't do, so it's too soon to ask others to tell you how or do it for you.
 
One reason that beginners find it hard to solve problems is that they don't break down the bigger problem in front of them into smaller parts to determine which part is actually at issue. It's a skill that people develop over time but the sooner you can start doing so the better, so here's your chance to start doing that. Your problem is actually three separate problems:
  1. How to get all the files in a folder.
  2. How to determine whether a file is new, i.e. was created after a particular date/time.
  3. How to copy a file.
All three of those is completely independent. The fact that you're doing all three together doesn't mean that they could each be used on their own in another app. As such, you should be researching and implementing each one separately. If you search for how to copy new files between folders then you're unlikely to find too many results. If you search for each of those three elementary tasks in isolation, you're likely to get results for all three, so you can implement all three. Once you can implement each task, you can put them all together to solve the overall problem. You shouldn't really need help with the individual tasks but you may need help with the integration of the solutions. See how you go.

hii 10x for replay
i know how to get all files
and i know how to copy files
but i dont know how to see or to get info about the new files
can you show me how to do it ?
 
Back
Top Bottom