# title: clean old desktop launcher links on Centos 6 Linux, Ubuntu 12 and probably others. # label: clean launchers (Linux) # # Old versions of jnlp would dump launcher links, and then wouldn't remove them when the version was removed with # the webstart GUI. This looks for launchers with bad local file links. # # Use by running this, then copy and paste the rm commands to a terminal. # from java.io import File from java.lang import System home= System.getProperty('user.home') dr= home + '/.local/share/applications/' ff= listDirectory( dr + '*.desktop' ) for f in ff: ss= open( dr + f ) for s in ss: if ( s.startswith( 'Exec=' ) ): if ( s.find( 'javaws ' )>-1 ): localfile= s.split()[-1] if ( not File( localfile ).exists() ): print 'rm -f "'+dr + f +'"' ss.close()