Has your digital picture or music library become so large that you have a hard time sifting through them to load up your devices? Well, why do yourself what your computer can do for you? With a simple customizable script, you can easily have Windows pick random files from one folder and copy them to another.


While copying random files from one directory to another is certainly not a traditional function, it does have its practical uses:

  • Load up a digital picture frame with random pictures from your library.
  • Pick random music from your music library to fill your MP3 player.
  • Anything else you can think of… post suggestions below.

Customizing the Script

Before using the Copy Random Files script, there are a few settings which you need to make (just right click on the script file and select Edit to open it in Notepad). The location of where you need to enter this information as well as additional details are clearly labeled in the script.

  1. Destination Folder – the directory where the random files should be copied to.
  2. File Filter – optionally specify the types of files you want to pick from (i.e. only JPG and PNG or only MP3 and OGG files).
  3. Search Sub-Directories – should the source include files from sub-directories as well?

You can create as many copies of the script as you want. So you can easily create a copy which picks random pictures, one which picks random music, etc. Just duplicate the Copy Random Files script, give it an appropriate file name and then customize accordingly.

Adding the Script to your Send To Menu

The Copy Random Files script is designed to work from your Send To context menu.

Open the Send To folder by navigating to:


Or you can just paste this location into your Run menu.

Create a new Shortcut in the Send To folder.

Select the source script which you have customized.

Enter a title as you want it to appear in the Send To menu.

Once finished, you can optionally change the icon which appears in the Send To menu by opening the Properties dialog of the newly created shortcut and clicking the Change Icon button.

Select the icon you want to use and apply your settings.

Using the Copy Random Files Script

Once the shortcut is in place, you can now start the copy function via the right-click context menu. Simply navigate to the folder which contains the files you want to copy from, right click on a file or folder and select the copy random files shortcut you previously created.

Note that you must be in the folder you want to be the source when you invoke the function. In our example below, if we were to invoke the command by right-clicking on the Sample Pictures folder in the parent folder (Libraries > Pictures), the parent folder would be picked up as the source folder instead of the Sample Pictures folder.

Once you select the command, the script will summarize the current configuration options and scan the source folder for the number of applicable files. This can take a while if you select a folder which contains an enormous amount of files. Once this is done, you will be asked for the number of random files to copy.

The script will run and copy the appropriate number of random files. You can view the progress by looking at the title bar during the copy process.

Note that if a file with the same name exists in the destination, it will be overwritten.

Once finished, you can see the files copied are a random subset of the source files.


Download Copy Random Files script from HowToGeek.com