(self)
Get latest existing file version on HDD
        :return: integer, maximum existing version
Get latest existing file version on HDD
        :return: integer, maximum existing version
Get latest existing file version on HDD : return : integer maximum existing version
def calculate_last_version(self):
        '''
        Get latest existing file version on HDD
        :return: integer, maximum existing version
        '''

        # # Get list of existing versions of file
        # list_existed = glob.glob('{0}{1}_*.{2}'.format(self.location, self.code, self.extension))
        #
        # list_versions = []
        # for file_path in list_existed:
        #     at_file = EveFilePath(file_path)
        #     list_versions.append(int(at_file.file_version))
        # last_version = max(list_versions)
        #
        # return last_version

        list_versions = []
        if self.type == 'path':
            # Get list of existing versions of FILES
            list_existed = glob.glob('{0}/{1}_*.{2}'.format(self.location, self.code, self.extension))
            list_existed = [name.replace('\\', '/') for name in list_existed]

            for file_path in list_existed:
                at_file = EveFilePath(file_path)
                list_versions.append(int(at_file.file_version))

        if self.type == 'location':
            # Get list of existing versions of FOLDERS
            list_existed = glob.glob('{0}/*'.format(self.location))
            # Filter non-version folder (by length) and fix slashes
            list_existed = [name.replace('\\', '/') for name in list_existed if len(name.split('\\')[-1]) == 3]

            for file_path in list_existed:
                at_file = EveFilePath(file_path)
                list_versions.append(int(at_file.folder_version))

        last_version = max(list_versions)

        if last_version:
            return last_version
        else:
            print '>> ERROR! Calculating last version fails.'
def calculate_last_version ( self ) : # # Get list of existing versions of file # list_existed = glob.glob('{0}{1}_*.{2}'.format(self.location, self.code, self.extension)) # # list_versions = [] # for file_path in list_existed: #     at_file = EveFilePath(file_path) #     list_versions.append(int(at_file.file_version)) # last_version = max(list_versions) # # return last_version list_versions = [ ] if self . type == 'path' : # Get list of existing versions of FILES list_existed = glob . glob ( '{0}/{1}_*.{2}' . format ( self . location , self . code , self . extension ) ) list_existed = [ name . replace ( '\\' , '/' ) for name in list_existed ] for file_path in list_existed : at_file = EveFilePath ( file_path ) list_versions . append ( int ( at_file . file_version ) ) if self . type == 'location' : # Get list of existing versions of FOLDERS list_existed = glob . glob ( '{0}/*' . format ( self . location ) ) # Filter non-version folder (by length) and fix slashes list_existed = [ name . replace ( '\\' , '/' ) for name in list_existed if len ( name . split ( '\\' ) [ - 1 ] ) == 3 ] for file_path in list_existed : at_file = EveFilePath ( file_path ) list_versions . append ( int ( at_file . folder_version ) ) last_version = max ( list_versions ) if last_version : return last_version else : print '>> ERROR! Calculating last version fails.'