private static String printChanges ( DbxClientV2 client , String cursor ) throws DbxApiException , DbxException { while ( true ) { ListFolderResult result = client . files ( ) . listFolderContinue ( cursor ) ; for ( Metadata metadata : result . getEntries ( ) ) { String type ; String details ; if ( metadata instanceof FileMetadata ) { FileMetadata fileMetadata = ( FileMetadata ) metadata ; type = "file" ; details = "(rev=" + fileMetadata . getRev ( ) + ")" ; } else if ( metadata instanceof FolderMetadata ) { FolderMetadata folderMetadata = ( FolderMetadata ) metadata ; type = "folder" ; details = folderMetadata . getSharingInfo ( ) != null ? "(shared)" : "" ; } else if ( metadata instanceof DeletedMetadata ) { type = "deleted" ; details = "" ; } else { throw new IllegalStateException ( "Unrecognized metadata type: " + metadata . getClass ( ) ) ; } System . out . printf ( "\t%10s %24s \"%s\"\n" , type , details , metadata . getPathLower ( ) ) ; } // update cursor to fetch remaining results cursor = result . getCursor ( ) ; if ( ! result . getHasMore ( ) ) { break ; } } return cursor ; }
Prints changes made to a folder in Dropbox since the given cursor was retrieved .