def DemoCopyFile(): # Create a file on the device, and write a string. cefile = wincerapi.CeCreateFile( "TestPython", win32con.GENERIC_WRITE, 0, None, win32con.OPEN_ALWAYS, 0, None) wincerapi.CeWriteFile(cefile, "Hello from Python") cefile.Close() # reopen the file and check the data. cefile = wincerapi.CeCreateFile( "TestPython", win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, 0, None) if wincerapi.CeReadFile(cefile, 100) != "Hello from Python": print("Couldnt read the data from the device!") cefile.Close() # Delete the test file wincerapi.CeDeleteFile("TestPython") print("Created, wrote to, read from and deleted a test file!")
def delete(args): """delete file, ... Delete one or more remote files """ for arg in args: try: wincerapi.CeDeleteFile(arg) print("Deleted: %s" % arg) except win32api.error as details: print_error(details, "Error deleting '%s'" % arg)