How to only copy NEW files to a folder using a batch file (syncing) – (Batch Files #6)
How to only copy NEW files to a folder syncing (Batch files part 6)
xcopy “C:UsersHow2win7DesktopPodcast downloads” “F:Podcasts” /d
Follow me on other media:
Marathon Man (audionautix.com)
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.
Xem thêm Bài Viết:
- Trải nghiệm mới hay ho với hướng dẫn cài Mac Os trên vmware
- Bật mí cách cài đặt ssl miễn phí lên Let’s Encrypt
- Tuyệt chiêu tạo usb boot kali linux đơn giản dành cho bạn
- Hướng dẫn chi tiết từ A – Z các bước cài đặt Python trên Windows 10
- Bật mí quy trình cài đặt Kali Linux trên Vmware đúng chuẩn và chi tiết