use File::stat;
use Time::localtime;
use strict 'vars';

my @directories_on_list = qw(
	advocado
	aerial
	ahc
	annualreports
	anthpubs
	anthrojour
	apis
	apr
	areastudies
	armenian
	arted
	arveson
	asami
	atkinson
	audio
	bahm
	baker
	banc_warc
	bancav
	bancbooks
	banccoll
	bancgen
	bancmad
	bancmf
	bancoac
	bancopto
	bancpict
	bancroftiana
	bancselect
	bancselectihi
	bart
	bene-legere
	berkeleycomputing
	berkeleyjournal
	bibblue
	bibliarabinica
	bioenergy
	bios
	biosmaps
	bonney
	bonneyihi
	bpatron
	bps
	brit
	busi
	ca_legal
	calcultures
	calcultures/ucb
	calheritage
	callbulletin
	campusphoto
	cap
	cara
	cardinell
	cas
	cas/abag
	cas/pahlavi
	cas/power
	cas/ushistbusi
	cas/uspreselections
	cas/wind
	cas/worldwind
	casedphotos
	cavpp
	cawomen
	ccsl
	ceda
	cedlectures
	censusdata
	cent
	cfp
	chainoflife
	christmascarol
	church
	cic
	cihi
	cityarts
	coalition
	colby
	collections
	conner
	connerfiles
	content
	cposters
	craftsman
	crivelli
	cro
	cuban
	culrev
	cunews
	dailycal
	davidson
	dayscal
	debt
	doble
	drefdisk
	drilm
	drweber
	ds
	dtds
	ealbooks
	ealtw
	earlyreaders
	eart
	eartihi
	eartmaps
	ebiannual
	ebibulletin
	ebinsider
	eckbo
	edp
	election
	engi
	engidisk
	envi
	eqf
	etd
	ethnodocs
	evenpost
	examiner
	farrand
	fenollosa
	fiatlux
	fiatlux-newsletter
	filmart
	film-kurier
	findingaids
	fonoroff
	footballfilms
	friedman
	fromer
	fsm
	ftk
	furtwangler
	galc
	gee
	generalcatalog
	georgemiller
	germany
	ggva
	gil
	goin
	goldmanfund
	grah
	graham
	graves
	guadet_howard
	hastamudra
	hearst
	hearstmf
	hhb
	hiram
	histopo
	hojishinbun
	honeyman
	howland
	hpc
	hslp
	hstc
	ieas
	ierp
	ietcom
	ietele
	ietfec
	ietisy
	ietsy
	igs
	intldocs
	investments
	ipconner
	irene
	irle
	italo
	its
	jais
	jais2
	jais4
	jarda
	jekyll
	jessecook
	jghoward
	jinping
	jiyi
	jjoyce
	jointops
	jpnmaps
	jpnprints
	jvac
	kalx
	komenich
	lafrase
	landcase
	landinfo
	landscan
	lauc4
	lee
	levinson
	lib
	literatur_kritik
	lobby_cards
	loyaltyoath
	lucero
	magnes
	main
	mammoth
	marktwain
	math
	matsui
	maybeck
	meiklejohn
	mellon
	merriam
	metabolism
	metcalf
	misc
	missionschool
	moac
	moffitt
	moorea
	morrisonlectures
	mrc
	mrcmkv
	mtnotebooks
	mtp4
	muir
	muller
	musi
	music
	mvmaps
	mvp_nineveh
	naacp
	nationalwriting
	ncl
	ndnp
	neilmarcus
	news
	nowinski
	nrlftoc
	nwp
	oakland
	ohc-newsletter
	oralhistories
	oroville
	papyrusplond
	pfa
	physicscoll
	physicsmtg
	physlect
	polynesianvocab
	portchicago
	ppie
	pra
	prntscan
	proquest
	prosser
	regatta
	reichard
	rippey
	ritz
	robbins
	roho
	rohoia
	royston
	rube
	rww
	sampe
	sdtr
	sfbagals
	sfpost1906
	sheetmusic
	sierraclub
	slavic
	sloan
	socialprotest
	sqn
	stata
	stonerubbings
	straits_settlements
	sugoroku
	sundaytimes
	sunsite
	supreme
	swift
	sx
	tartini
	techreports
	techtoc
	text
	theses
	turnbull
	tutorials
	uarc
	ubc
	UCBonly/accademiapontaniana
	UCBonly/aggdata
	UCBonly/ahc
	UCBonly/airbnbmove
	UCBonly/alfabeta
	UCBonly/almasar
	UCBonly/analytica
	UCBonly/analytica/ucb/text/cis
	UCBonly/analytica/ucb/text/econ
	UCBonly/analytica/ucb/text/poli
	UCBonly/anthpubs
	UCBonly/aor
	UCBonly/arf
	UCBonly/arma
	UCBonly/asla
	UCBonly/bluebook_optometrists
	UCBonly/busi
	UCBonly/cis
	UCBonly/crit
	UCBonly/eal
	UCBonly/ebsco
	UCBonly/econ
	UCBonly/envi
	UCBonly/fdr
	UCBonly/funambulist
	UCBonly/goodeys
	UCBonly/iastudies
	UCBonly/icma
	UCBonly/interim
	UCBonly/italo
	UCBonly/itu
	UCBonly/lacanian
	UCBonly/lamaza
	UCBonly/ldc
	UCBonly/lobby_cards
	UCBonly/main
	UCBonly/mcd
	UCBonly/mozartfest
	UCBonly/pagaz
	UCBonly/pitchbook
	UCBonly/planecon
	UCBonly/planificacion
	UCBonly/poli
	UCBonly/polidata
	UCBonly/pres
	UCBonly/proquest
	UCBonly/regards
	UCBonly/rehva
	UCBonly/rerc
	UCBonly/rims
	UCBonly/rrj
	UCBonly/stata
	UCBonly/thomson
	UCBonly/uclaforecast
	UCBonly/un
	UCBonly/unes
	ucbrda
	ucdp
	uchda
	UConly/EART
	uranja
	var
	video
	vietnamphotos
	vtm
	wald
	wangshi
	warposters
	warsupply
	williampgray
	wtc
	wurster
	ww2_nsp
	wwii
	zamorano
);

my @roots = qw(
		/netapp/pa
		/netapp/da
);

my %alldirs;
foreach my $root (@roots) {
	opendir (DIR, $root) or die "Couldn't open directory $root for reading: $!\n";
	my @dirs = grep (!/^\./, readdir (DIR));
	closedir (DIR);
	
	foreach my $dir (@dirs) {
		my $dirpath = "$root/$dir";
		if (-d $dirpath) {
			$alldirs{$dir} = $dirpath;
			if (grep (/^$dir$/, @directories_on_list)) {
				delete $alldirs{$dir};
			}
		}
	}
}

foreach my $dir (sort keys %alldirs) {
	my $timestamp = ctime(stat($alldirs{$dir})->mtime);
	my ($year) = $timestamp =~ /([12]\d\d\d)\s*$/;
	print "$dir ($year)\n";
}