Using XXCOPY to Copy Files from Multiple Subfolders to One Folder

I was using Windows 7. I had files in multiple subfolders within D:\Folder\Subfolder A. I wanted to copy all *.wav and *.mp3 files from those subdirectories to the D:\Target directory. This was apparently called directory (or folder) “flattening.”

After some flailing around, with looks at COPY and XCOPY, I decided to try XXCOPY (rated four stars at Softpedia). This command-line tool, free for personal use, offered many command-line options.

It had been a couple of years since I had even looked at XXCOPY, and possibly the first time I had used it since the 1990s. At the time of writing this post, I was not sure what additional options I might ideally want or need for this task. I hoped to get into this job and get out quick, so I tried the simplest combination I could manage. I may add to this post later, if I use XXCOPY again in the next 20 years.

For my immediate task, I decided to combine the necessary commands in a batch file. That way, I could save the file and not have to research this matter again, at least not for this particular task. The batch file I built (with guidance from Ken at XXCOPY located after 1 2 searches) was as follows:

echo off
xxcopy "D:\Folder\Subfolder A*.wav" D:\Target\ /SGO >  "XXCOPY Error Log.txt"
xxcopy "D:\Folder\Subfolder A*.mp3" D:\Target\ /SGO >> "XXCOPY Error Log.txt"
echo Search XXCOPY Error Log.txt for "Copy Failed" messages.
echo I believe those result when the path is too long.

To create that batch file, I put that code into a file called “Run This to Copy MP3s.bat” and double-clicked on it in Windows Explorer. I could also have typed the file name on the command line (with quotation marks, because the name contained spaces).

At this point, I did not verify that the copy got everything; in fact, as noted in the remarks (above), some attempts produced “Copy Failed” errors. It appeared the solution to that problem would be to shorten the paths of the files that failed to be copied. Perhaps in some later attempt I will need to verify that everything copies correctly, and may update this post accordingly.

Incidentally, my next step was to convert the copied WAV files to MP3 for copying into an MP3 player. Based on previous experience and a review of the help file, it appeared that Boxoft WAV to MP3 Converter would be fine for that purpose, now that I had copied all of the WAVs into a single folder. It also appeared that this Boxoft product would do individualized conversion (involving e.g., files in different folders) if I wanted to work up individual command lines (using e.g., the Excel approach described in that previous post). But the Boxoft command line did not permit wildcards — along the lines of “convert *.WAV to *.MP3” — so I could not include a command to that effect in the batch file shown above.

This entry was posted in Uncategorized and tagged , , , , , , , , , , , , , . Bookmark the permalink.

One Response to Using XXCOPY to Copy Files from Multiple Subfolders to One Folder

  1. freddy96 says:

    Hello user,
    You can use LongPathTool also..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s