How to only copy NEW files to a folder using a batch file (syncing) - (Batch Files #6)

preview_player
Показать описание
How to only copy NEW files to a folder syncing (Batch files part 6)

Sample commands:

xcopy "C:\Users\How2win7\Desktop\Podcast downloads" "F:\Podcasts" /d

#batchfile #batch

Follow me on other media:

Music used:

Annotations:

In this example I'm going to demonstrate this with the scenario of moving newly downloaded podcasts to an mp3-player.

If you do this for multiple folders, this batch file will save you a lot of time compared to manually copying.

In my folder 'Podcast downloads' I have all 8 episodes of a podcast I'm following.

On my mp3-player however, I only have the 5 first episodes.

First, create a .txt in your source folder:
Right-click in the folder → New → Text Document

Name your text document and open it.

Type "Xcopy", which is a copy command, ...

Followed by the source folder filepath, (which you can copy from the folder's window address bar)...

I only want to copy mp3 files, so I add: "\*.mp3", which means that the command is only valid for files that end with ".mp3" in this folder.

Remember to start and end filepaths with quotation marks (").

Type a space, and then type the destination filepath.

end the command line by typing the switch "/d".

This will make sure the batch file will only copy source files that are newer than the files in the destination folder.

Save the text document and close it.

Rename the file extension of the text document to '.bat' to make it into a batch file.

Double-click the batch file to execute it.

It works! You can now see that your files are being copied in the command window.

Done, all files are copied!
Рекомендации по теме
Комментарии
Автор

was asking "IT" experts and they couldnt answer this question lol. Thanks!

abrahamalaniz
Автор

How to copy new files only and paste them in a completely new folder ? I want to copy the difference between folder A and B and paste the difference in a C folder.

noellawhittard
Автор

Does this copy newly modified files too?

sonicwingnut
Автор

Hi sir, i need a query for using xcopy command in windows to copy recent files in source location

rajiv
Автор

Thanks , it works, Now I should not pay for the GUI tools that can do this job like GoodSync, Gs Richcopy 360, Teracopy

sonefiacaven
Автор

hello, what if I have to copy folders instead of files? (with tons of different files and folders inside)

TonyPizzaPie
Автор

How to overwrite automatically while copying? Could you share the code pls

jeromej
Автор

Can you provide a batch file which can copy only yesterday created file not today.

bhupendersingh
Автор

Hi im having 2 windows 10 pcs on same network, How to auto copy new files (fle extension is .GDB) from on PC to another on regular intervals. can you please send the code

shettymanish
Автор

thanks buddy u solution was awsome...it worked for me

pervez
Автор

but it is asking me override the old files in destination

FaridMobasseri
Автор

thanks for answer, but i have to send this file to other people so destination of file will be different. i tried to use %CD% but no luck any idea ?

CodingWithAS
Автор

is there a way to copy only the latest file? in this case only the podcast 008.mp3? i need this to backup only the latest version of a project but not the old ones and my file are named "ProjectName_AssetName_V###". thanks!

woland
Автор

Hi, when i have 4 file with different extension, in my folder and i want to copy these 4 in different location ? what should i write instead of d??

CodingWithAS
Автор

How can I get the batch file to show the job while it's in progress?

chrisinak
Автор

The cmd window says "access denied" when I try to copy files to the c directory. Is there any way to fix this?

backupbrothers
Автор

Hey guys can you help me, I would like to run my macro from the excel file using bat file. Can you suggest that video to me.

gauravbhatt
Автор

with xcopy i dont need to download apps with a browser

VirtualizerExtreme
Автор

Hi Guido, thanks for sharing. I want to back up all of my pictures doing this. Is there a way to make this program copy all of the contents of sub folders? For example if I have a folder in pics named "Dogs" and one named "Kids" and one named "Cars" I want it to copy everything that has been added to those folders.

Lumencraft-