[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

RE: Shell script for removing FrameMaker debris files



Hedley,

If you've got Perl, you can use this script to clean up your current
directory.  Just put the script in the directory containing your FrameMaker
document and double click on the script file.  It creates a Backup folder
and moves all backup files into that folder.  You can then delete the Backup
folder in one toss, rather than worrying that you've selected all the right
files.

One day I'll have enough time to hack with Windows to figure out how to have
only one copy of the script (rather than per directory), but it works well
enough for me right now.

The nice thing about Perl is that over time I've used forms of this script
on Macintosh, UNIX, and Windows.

Simon

==========================================================================

#!/usr/bin/perl

if (! -e "backup") { 
   mkdir("backup",0777); 
   print "Created backup directory.\n";
   }

opendir(DIR,'.');
@filenames=readdir(DIR);
for (@filenames) {
   next if $_ eq '.';
   next if $_ eq '..';
   if ($_ =~ /.backup./ && $_ =~ /.fm|.book|.ixc/) {
      $source = $_;
      $dest = "backup/" . $_;

      rename($source,"$dest") || print "Can't rename '$source' to '$dest'.\n";
      print "$source renamed to $dest.\n";
   }
}
closedir(DIR);

print "Done.";
$temp = <STDIN>;

=============================================================


** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **