Backup_folder_path = "C:\ProgramData\Bookmark_Backup" # give here the destination path where you want to save bookmark files from google chrome for all the users.

import os
import shutil
import ctypes

class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)

with disable_file_system_redirection():
    UserAccount_Names=os.popen("wmic UserAccount get Name").read().strip().splitlines()[1:]

if not os.path.exists(Backup_folder_path):
    os.makedirs(Backup_folder_path)

for i in UserAccount_Names:
    bookmark_file = "C:\\Users\\%s\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Bookmarks"%(i.strip())
    if os.path.exists(bookmark_file):
        destination_folder = Backup_folder_path + "\\%s"%(i.strip())
        if not os.path.exists(destination_folder):
            os.makedirs(destination_folder)
        try:
            shutil.copy(bookmark_file, destination_folder)
            print("!!!bookmark file backup is successful for the user - %s"%(i.strip()))
        except Exception as e:
            print(e)
    else:
        print("bookmark file doesn't exist for the user - %s"%(i.strip()))
    
    