oss_src/graphlab/util/fs_util.cpp
void graphlab::fs_util::
list_files_with_prefix(const std::string& pathname,
                       const std::string& prefix,
                       std::vector<std::string>& files,
                       bool ignore_hidden) {
  namespace fs = boost::filesystem;  
  fs::path dir_path(pathname);
  fs::directory_iterator end_iter;
  files.clear();
  if ( fs::exists(dir_path) && fs::is_directory(dir_path)) {
    for( fs::directory_iterator dir_iter(dir_path) ; 
         dir_iter != end_iter ; ++dir_iter) {
      if (fs::is_regular_file(dir_iter->status()) ) {
        const std::string filename = dir_iter->path().filename().string();
        if (prefix.size() > 0 && !boost::starts_with(filename, prefix)) {
          continue;
        }
        if (!ignore_hidden || !is_hidden(dir_iter->path().leaf().string())) {
          files.push_back(dir_iter->path().string());
        }
      }
    }
  }
  std::sort(files.begin(), files.end());
}
// end of list files with suffix  
end of list files with suffix
end of list files with suffix
void graphlab::fs_util::
list_files_with_prefix(const std::string& pathname,
                       const std::string& prefix,
                       std::vector<std::string>& files,
                       bool ignore_hidden) {
  namespace fs = boost::filesystem;  
  fs::path dir_path(pathname);
  fs::directory_iterator end_iter;
  files.clear();
  if ( fs::exists(dir_path) && fs::is_directory(dir_path)) {
    for( fs::directory_iterator dir_iter(dir_path) ; 
         dir_iter != end_iter ; ++dir_iter) {
      if (fs::is_regular_file(dir_iter->status()) ) {
        const std::string filename = dir_iter->path().filename().string();
        if (prefix.size() > 0 && !boost::starts_with(filename, prefix)) {
          continue;
        }
        if (!ignore_hidden || !is_hidden(dir_iter->path().leaf().string())) {
          files.push_back(dir_iter->path().string());
        }
      }
    }
  }
  std::sort(files.begin(), files.end());
}
void graphlab :: fs_util :: list_files_with_prefix ( const std :: string & pathname , const std :: string & prefix , std :: vector < std :: string > & files , bool ignore_hidden ) { namespace fs = boost :: filesystem ; fs :: path dir_path ( pathname ) ; fs :: directory_iterator end_iter ; files . clear ( ) ; if ( fs :: exists ( dir_path ) && fs :: is_directory ( dir_path ) ) { for ( fs :: directory_iterator dir_iter ( dir_path ) ; dir_iter != end_iter ; ++ dir_iter ) { if ( fs :: is_regular_file ( dir_iter -> status ( ) ) ) { const std :: string filename = dir_iter -> path ( ) . filename ( ) . string ( ) ; if ( prefix . size ( ) > 0 && ! boost :: starts_with ( filename , prefix ) ) { continue ; } if ( ! ignore_hidden || ! is_hidden ( dir_iter -> path ( ) . leaf ( ) . string ( ) ) ) { files . push_back ( dir_iter -> path ( ) . string ( ) ) ; } } } } std :: sort ( files . begin ( ) , files . end ( ) ) ; }
end of list files with suffix
end of list files with suffix