Search code examples
windowsbatch-filejobsrating

Windows Batch File that Copy Rated Files


Hi StackOverflow Community,

I would like to ask if there's a way to copy the files which are rated using a Windows Batch Job (.bat).

The files are photos, and some were rated in-camera. When all of these files (rated and unrated) are copied to my hard drive, I would like to let the batch job automatically copy out the files that are rated into another folder.

I know that my computer has no problem viewing the ratings as when I view the Properties of the rated files, a number of stars are displayed in it.

Any help is much appreciated, and thank you in advanced =)


Solution

  • Check tooltipinfo.bat.If the passed item is rated it will have in the output something like :

    Rating: 5 Stars
    

    so you need the tooltipinfo.bat in your directory.Then create batch file like :

    (not tested)

    @echo off
    
    set folder_with_the_items=C:\photos_and_videos
    set destination_folder=C:\somewhere_else
    
    for /f "tokens=* delims=" %%a in ('dir /a:-d /b /s "%folder_with_the_items%\*"') do (
       call tooltipinfo.bat "%%~fa" | find /i "Rating:" >nul 2>nul && (
            copy "%%~fa" "%destination_folder%"
       )
    )
    

    As you'll need to change the folder locations at the beginning of the script.