- Risks in switching from ‘Copy always’ to ‘Copy if newer’
- 1 Answer 1
- Not the answer you’re looking for? Browse other questions tagged c# visual-studio or ask your own question.
- Related
- Hot Network Questions
- Subscribe to RSS
- Copying only newer files from one folder to another
- 2 Answers 2
- Copy only changed files (new & modified) in Windows 10
- Replies (9)
Risks in switching from ‘Copy always’ to ‘Copy if newer’
In order to avoid rebuilding the libraries that have not been touched I’m changing Copy to Output Directory for some files from Copy always to Copy if newer in some c# projects.
The files whose setting is changed have their Build Action set to one of Content, Embedded Resource, or Resource.
What are the risks accompanied with this?
1 Answer 1
Besides this probably being obsolete (e.g. due to resources being embedded), the only risk I could think of right now would be the fact that you could use outdated files in case some program changes something without updating the file’s timestamp (or modifying this timestamp). For example, you might do some local changes to a file, then revert its contents using some kind of file versioning system (like SVN or HG). It’s then possible that Visual Studio won’t notice the reverted file and it might not copy it.
Not the answer you’re looking for? Browse other questions tagged c# visual-studio or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Copying only newer files from one folder to another
I have 2 folders with files. These files are the product of some build process. The first folder is the outputs of previous build while the latter is the output of the current build.
I would like to somehow diff these 2 folders from the command line/build script and copy only files that were added or files that are new into some other folder.
Based on this, the copy operation i am interested in, will copy only b.txt and d.txt into some other folder (not into folder2).
Basically, i am only after the «deltas» and i would like to store these some place.
Is this possible using standard command line tools that come with Windows? (suppose Windows 7/Server 2008 or higher)
2 Answers 2
Use XCOPY with /D and /L options, «copying» from folder 1 to folder 2.
The /D option restricts the copy to only new or modified files.
The /L option causes the command to list the files that would be copied, but prevents any copies from actually being made.
Then use FOR /F to process those results and actually copy the files to folder 3.
If put in a batch file, then all % must be doubled as %% .
The XCOPY also prints out a summary of how many files are (would be) affected. The above will attempt to copy a file with the summary count «name», and of course fail. The redirection of output to nul prevents the error message from displaying. I tested on Windows 7 and was surprised the error message was on stdout and not stderr. If the error message on other versions is appearing on stderr, then the command should also get 2>nul to prevent the error message.
But there is a risk in hiding the error messages — what if a copy fails for some reason?
Here is a script that will list all files that were successfully copied, as well as indicate which (if any) failed. It uses FINDSTR to filter out the unwanted file count. It assumes the file count is in English, with the form NNN File(s) , so it would have to be modified for other languages.
Here is a more complex variant that works with any language. It saves each file name to a variable and delays the copy until the next loop iteration. The last entry (the count) never gets copied.
Copy only changed files (new & modified) in Windows 10
How to Copy Only New Files and Changed Files to my backup USB to do a backup.
—- You could do this on Old DOS and Window before they fixed it in Windows 10 —
Her is the Situation:/Problem
I drag a bunch of folders to the destination (my (USB backup drive) and copying begins
Then I get a window that says destination has files with the same name and asks if :
1. I want to replace the files
2. Skip these files
3 let me decide what to do with each individual file
copy «»»»changed»»»» files only — Remember that?
Window 10, in it’s wisdom, no longer seems to have this option — even though the files still have dates and sizes.
I used to be able to say copy ( or move) changed files only. bing, bang, bata boom and it’s done.
Because of this I Must either:
1 not save the updated files- even though they have been updated based on the new file date
2 replace all of the files which is waste of time and resources (there are 3307 files that I copy)
or decide on each file what I want to do on 3307 files also a major waste of my time. That would take me days.
On previous Windows and DOS you could copy changed files only.
——Where is that option in windows 10 operating system? ———
I can buy a simply program like copywiz to do that for $29 dollars or use the dos Xcopy at the command prompt but really? This is the best the new wonderful window 10 can do? Search hardly works and now the Copy command is pathetic too?
Does anyone have any idea what to do besides DOS or paid copy programs?
Also, how much longer will windows 7 be supported by Microsoft.
I ask because MS support is so willing to help that their people say go back to 7. I assume they have no interest in fixing this well know issue. That was a good program and I am considering going back. until windows 10 beta testing is done using all of us as guinea pigs.
Replies (9)
Select Let me decide for each file and then in the File Conflict dialog choose the option to Skip N files with the same date and size:
82 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thank you for this response. It’s an interesting workaround and I will naturally take it under consideration even though it’s a workaround that doesn’t exactly fit my needs as a user and all of my circumstances.
I know we can’t have everything of course and if Microsoft wants to eliminate this method of copying, that has worked well all this time, they can do so. However, what I am still looking for is an answer to this question —
How to make windows 10 work like older versions of windows and even as old as DOS 3 plus. by copying only changed files rather then wasting either my time making individual choices on 3000 plus files or wasting my resources copying all of the 3000 plus files. if having to use yet another work around to do what is so simple to in other older versions of window.s. I can use the proper DOS Xcopy commands at the command promt of course, but this is supposed to be the newest and the best so why would I use DOS to get the job done or have to use a workaround?
I only drive my 1929 ford for show not because I expect it to go 120 MPH in 5 seconds flat.
I wold like the system to copy only changed files as an option when I copy or move a file to another drive or to my backup USB drive
Do you by chance know how to make «that» work?
10 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Hi RoberttWin and thank you for your quick response to this.
Unfortunately, this does no solve the problem because my version of window 10 appear to be different from yours.
Select Let me decide for each file and then in the File Conflict dialog choose the option to Skip N files with the same date and size:
Let me decide I don’t get that option: Hers is what I show.
Notice that my choice is to skip 0 files with same date and size out of ( in this case) 720 files although it shows 720 files with the same date and size.
I don’t know why that is. Do you know how to make it read the correct number?
Also this give me a choice of which to keep if I copy the files.
Is it not true that If I am making a —COPY — elsewhere that I want to keep the original files? If however I din’t want the originals to stay in place that I would —MOVE — the files. Have he definitions of these words changed or is Microsoft now using offshore programmers who don’t really understand the US language that well.
I want to keep both with the — Same — Name. If I want to copy why would they even ask?
If I had the skip option on my windows 10 version your solution might work though — unless it renames the files which I don’t want.
Thanks — I hopefully await your reply
5 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Well I found other posts which I missed before. Here seems to be the problem as of Aug 31 2015 but not the answer.
No it doesn’t work according to MS — and it has not been fixed in over one year. see below.
Windows 10 — Copy and paste functionality in file explorer
Each day, I copy a number of files from my office computer to my home computer as a back up. As I update these files in my office computer, I copy and replace the older versions on my computer at home.
When I did copy and replace in Windows 7, for each file name that was already existing in my home computer, Windows 7 would give me a message for copy and replace giving the date of file modified and label it as Newer. For all «newer» files, I would them accept the copy and replace function.
I found this functionality in Windows 7 extremely useful since it would protect me from accidental replacement of a newer version with an older version. Just by checking the «Newer» word in the prompt, I would click yes.
This functionality is missing in Windows 10. It only provides an option where I have to manually compare and determine the newer version, and I find this loss of functionality very irritating (it was so much easier when Windows 7 did the compare and labelled newer files). I can’t understand why Microsoft removed this functionality.
I called Microsoft support but the only solution they gave me is to go back to Windows 7 (a suggestion that I found to be extreme).
Am I the only one missing this functionality? Is there a work-around for this?
Any help or advice would be greatly appreciated as I am missing this functionality — I use it everyday.
Is there any hope that Microsoft will add this functionality to Windows 10 in the future?
Thank you very much.
11 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Notice that my choice is to skip 0 files with same date and size out of ( in this case) 720 files although it shows 720 files with the same date and size.
1. I see 760 conflicting files. Where are you getting the 720 number from?
2. You’re wrong, the two sets of files don’t have the same date and size. The files in K: are all newer than those in F:, as shown clearly by the fact that their dates are in bold text. So even if the sizes match (since neither size text is in bold), the dates don’t and so the files are not necessarily the same.
Is it not true that If I am making a —COPY — elsewhere that I want to keep the original files? If however I din’t want the originals to stay in place that I would —MOVE — the files.
Who says the files in the original location i.e. F: won’t be kept? The dialog is clearly asking whether in the target folder i.e. K:, you want to keep copies of the original set of files from F:, or you want to retain the new files already in K:.
Have he definitions of these words changed or is Microsoft now using offshore programmers who don’t really understand the US language that well.
No offence, but just because you didn’t understand the dialog doesn’t mean others don’t. I’ve been around the world enough to have met lots of foreigners who could speak English better and write both English and code better than their counterparts here. Personally, when I’m faced with genuine OS issues I couldn’t care less about the background of the developers. They’re MS employees, that’s all I know, and so I want them to fix their damn mistakes wherever they are, be it America, China, Russia or Addis Ababa.
I want to keep both with the — Same — Name.
You can’t keep both sets of files with the same name in the same folder. This has never been possible. All you can decide to do with the dialog above is, as I’ve already said, choose to keep the newer files in K: or overwrite them with the older ones from F: (or keep both versions in K: with the ones from F: being automatically renamed). The original files in F: will of course be left untouched since you’re copying and not moving, exactly as you want.
If I want to copy why would they even ask?
They’re asking because the file names are conflicting. Couldn’t be simpler. Now you decide which version of the files you want ending up in K:.
With a multi-file copy/move Win10 doesn’t prompt you for each file whether it is newer or older than the one with the same name in the target folder. Instead it shows you a dialog where it highlights which file in each pair is newer, and which file in each pair is bigger. If you select both of a pair then it will rename the file being copied so both versions can co-exist in the target folder.
Now is the current implementation perfect? Of course not. For example see the following case:
As you can see the Source versions of Files 1 & 3 are newer, but the Target versions of Files 2 & 4 are newer. Now what if one wants to end up with only the newer files in the Target folder (i.e. copy Files 1 & 3 from Source but leave Files 2 & 4 untouched in the Target)? Currently there’s only a Select All checkbox for each column, so one would have to manually select Files 1 & 3 from the first column and Files 2 & 4 from the second. This is obviously impossible when one has hundreds of files in each column to select.
Instead if they had options like i) Select only the newer files, ii) Select only the older files, iii) Select only the smaller files and iv) Select only the bigger files, then IMO the dialog would be far more useful.
Edit: Here are the XP and Win7 file conflict dialogs:
Where’s the «copy «»»»changed»»»» files only» option you were talking about?