Check mp4 integrity in c++ I have a big collection of MP4 files and an unstable internet connection so I use this batch file to check for the files integrity.

Having posted this primitive code and received valuable reviews, I decided to take into consideration as much as I can, especially not mixing C code unless when using Windows API  and implement the said batch file using that code as the basis.

This program works in CMD it takes a path to MP4 location as argument.

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;windows.h&gt;

#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif

bool DirectoryExists(const std::string&amp; path)
{
   DWORD present = GetFileAttributesA(path.c_str());

   if (present == INVALID_FILE_ATTRIBUTES)
          return false;

   if (present &amp; FILE_ATTRIBUTE_DIRECTORY)
          return true;

   return false;
}

std::string replace (const std::string&amp; path)
{
   std::string in = path;
   std::replace(in.begin(), in.end(), '\\', '/');
   return in;
}

void findVideos (std::string&amp; fspath)
{
   while(*(fspath.rbegin()) =='/')  //to get rid of trailing '/' like a user inputs path/to/file//////\\\
       fspath.pop_back();

   size_t i=1;
   WIN32_FIND_DATA FindFileData;
   std::string destpath = fspath + std::string("/")+ std::string("*.mp4");
   std::string ffmpegPath = "ffmpeg.exe -v error -f null - -i ";

   HANDLE hFind = FindFirstFile(destpath.c_str(), &amp;FindFileData);

   if (hFind != INVALID_HANDLE_VALUE)
   {
        do 
          {
            std::string fullpath = std::string(fspath)+std::string("/")+std::string(FindFileData.cFileName);
            std::cout&lt;&lt;i&lt;&lt;"-"&lt;&lt;"Checking "&lt;&lt;fullpath&lt;&lt;" for errors"&lt;&lt;std::endl;
            std::string command = ffmpegPath +std::string("\"")+fullpath+std::string("\"");
            system(command.c_str());
            i++;
          } 
        while(FindNextFile(hFind, &amp;FindFileData));
   }
   FindClose(hFind);      
}

int main(int argc, char**argv)
{
    const char* path = argv[1];

    if (path == nullptr) 
    {
        std::cout&lt;&lt;"No path provided"&lt;&lt;std::endl;
        return 0;
    } 
    else  
        if ( DirectoryExists(path) )
           std::cout&lt;&lt;"Provided path is: "&lt;&lt;path&lt;&lt;std::endl;
        else 
             {
             std::cout&lt;&lt;"Path doesn't exist"&lt;&lt;std::endl;
             return 0;
             }

   std::string fspath;
   fspath = replace(path);
   findVideos (fspath);
   return 0;
}


The code is working, I am open to criticism and any way to improve it especially if I work in a professional company and asked to implement such program.

EDIT: Please forgive my ignorance about indentation and other programming paradigms, I graduated a year ago and failed to get an internship or a job in the domain. I tried to go with the comments as much as I can after reading some articles about indentations.
Missing Header File

You need to include algorithm so that std::replace() can be accessed.

Error Checking

Rather than checking if argv[1] is null, it might be better to use argc in the error check. If argc is not greater than 1 than there is an error. This is what argc is meant to be used for, as well as for a loop control when there are more arguments. It might be good to give an example of the proper program call as part of the error message. 

The else that follows the error check is not necessary because of the return statement.

The first return statement in main() should not return zero, it should return 1 to indicate a failure. What might be even better is to include cstdlib and use the system defined symbols EXIT_SUCCESS and EXIT_FAILURE.

It would be better to report errors to std::cerr.

int main(int argc, char** argv)
{
    if (argc &lt;= 1)
    {
        std::cerr &lt;&lt; "No path provided" &lt;&lt; std::endl;
        return EXIT_FAILURE;
    }

    const char* path = argv[1];
    if (!DirectoryExists(path))
    {
        std::cerr &lt;&lt; "Path doesn't exist" &lt;&lt; std::endl;
        return EXIT_FAILURE;
    }

    std::cout &lt;&lt; "Provided path is: " &lt;&lt; path &lt;&lt; std::endl;

    std::string fspath;
    fspath = replace(path);
    findVideos(fspath);

    return EXIT_SUCCESS;
}


Horizontal Spacing

A best practice in many programming languages is to put spaces between operators and operands, this makes the code much more readable and maintainable:

void findVideos (std::string&amp; fspath) {
    while (*(fspath.rbegin()) == '/')
    {
        fspath.pop_back();
    }

    size_t i = 1;
    WIN32_FIND_DATA FindFileData;
    std::string destpath = fspath + std::string("/") + std::string("*.mp4");
    std::string ffmpegPath = "ffmpeg.exe -v error -f null - -i ";

    HANDLE hFind = FindFirstFile(destpath.c_str(), &amp;FindFileData);

    if (hFind != INVALID_HANDLE_VALUE)
    {
        do
        {
            std::string fullpath = std::string(fspath)+std::string("/") + std::string(FindFileData.cFileName);
            std::cout &lt;&lt; i &lt;&lt; "-" &lt;&lt; "Checking " &lt;&lt; fullpath &lt;&lt; " for errors" &lt;&lt; std::endl;
            std::string command = ffmpegPath +std::string("\"") + fullpath+std::string("\"");
            system(command.c_str());
            i++;
        }
        while(FindNextFile(hFind, &amp;FindFileData));
    }
    FindClose(hFind);
}


Prefer Modern C++ constexpr Over #define

In C++ creating a constant using constexpr is preferred over a macro because it it type safe and a macro is not type safe.

#ifndef INVALID_FILE_ATTRIBUTES
constexpr DWORD INVALID_FILE_ATTRIBUTES = ((DWORD)-1);
#endif


Indentation

It would be better not to mix spaces with tabs when indenting. Many programmers use 4 spaces for indenting, by default a tab is 8 spaces. This can lead to inconsistent indentation as demonstrated in the function bool DirectoryExists(const std::string&amp; path) in the question. An IDE such as Visual Studio allows you to set the number of spaces used in a tab to prevent this problem, where notepad does not do this.

Replace

It's not clear that the function std::string replace (const std::string&amp; path) since windows understand both the forward and backward slash in file specifications.