Copy all files, skip those already existing, and delete those in destination not in source

1

I imagine this could be done with Robocopy - I want to copy my music library from its folder on my PC to my mp3 player. I have ~5000 songs, and I'll probably run the copy every time I add an album.

Now, just using Windows copy, I can say to skip pre-existing files and it will do so and run relatively fast. However, I want my destination (mp3 player) to reflect deleted music as well. I'm not sure if simply using a mirror command would do this - I assumed that wouldn't take into account pre-existing files.

Quick example:

Source folder:

song1.mp3
song3.mp3
song4.mp3

Destination folder BEFORE copying:

song1.mp3
song2.mp3
song3.mp3

Destination folder AFTER copying (Identical to source):

song1.mp3
song3.mp3
song4.mp3

The important point is that, while copying, song1.mp3 and song3.mp3 were skipped (NOT overwritten, or the copy will take forever - because I have many songs) and song2.mp3 was deleted.

Wilson

Posted 2013-07-07T23:25:54.180

Reputation: 11

What file system is the source and target? If both are NTFS a simple robocopy /MIR command will do exactly what you describe. It won't overwrite existing files. For example my own command looks like robocopy.exe "T:\music" "S:\music" /MIR /W:1 /R:1 /MT:8 /NDL. If your target file system is FAT you face a problem which can be solved with the switch /FFT

– nixda – 2013-07-07T23:46:01.270

Answers

1

I'd use something like this:

robocopy <Source> <Destination> /E /COPY:DAT /XO /PURGE /R:1 /W:1

From robocopy's help:

/PURGE :: delete dest files/dirs that no longer exist in source.
/XO :: eXclude Older files.

Nasir

Posted 2013-07-07T23:25:54.180

Reputation: 416

0

This seems like a task for a backup software. I haven't tried it, but cwrsync looks OK to me. It's a Windows packaging of a battle-tested F/OSS tool rsync with a GUI as a nice bonus.

Note that on the page I linked they say that "You must, however, have a working ssh system.", but I would not take it literally, the software should not refuse to operate short of ssh if both points are local.

Alois Mahdal

Posted 2013-07-07T23:25:54.180

Reputation: 2 014