Skip to content

Instantly share code, notes, and snippets.

@aruethe2
Last active June 29, 2020 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruethe2/c24555dcd11fa7ffbe921e95c32573d9 to your computer and use it in GitHub Desktop.
Save aruethe2/c24555dcd11fa7ffbe921e95c32573d9 to your computer and use it in GitHub Desktop.
Script to clean up garbage files after Gaussian jobs have been run on Strelka. Written by Paul Rablen.
#! /usr/bin/perl
# Script to clean up garbage files after Gaussian jobs have been run on strelka.
# (Written by Paul Rablen, June 2020)
# Find all the files of the form gaussian.#.*
#numjobs = 0;
opendir(THISDIR, ".");
@allfiles = readdir THISDIR;
closedir THISDIR;
foreach $file (@allfiles) {
if (substr($file,0,9) eq "gaussian.") {
# Get location of second "."
$i = index($file,".",9);
$j = $i-9;
# Get the job ID number.
$job[$numjobs] = substr($file,9,$j);
$numjobs++;
}
}
# Now delete the files associated with these jobs.
$uname=`whoami`;
chomp($uname);
for ($i=0; $i<$numjobs; $i++) {
print "rm gaussian.$job[$i].out\n";
`rm gaussian.$job[$i].out`;
print "rmdir /home/$uname/$job[$i]\n";
`rmdir /home/$uname/$job[$i]`;
}
print "rm fort.7\n";
print `rm fort.7`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment