#!/usr/bin/perl #reguest.pl #by Chris Monahan #this is free software, you can distribute it under the same terms as +perl itself use warnings; use strict; my @dirs = ("Music", "Pictures", "Documents", "Desktop"); print "preserving guest content under a timestamped folder \n \n"; my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdist) = gmtime(time); $min++; $hour++; $mday++; $sec++; $mon++; $year++; my $count = 0; my @mkdir = ( "$year:$mon:$mday", "$hour:$min:$sec"); chdir ("/home/guest-content"); while ($count ne @mkdir){ system "mkdir $mkdir[$count]"; chdir "$mkdir[$count]"; $count ++; } chdir ("/home"); $count = 0; while ($count ne @dirs){ my $dest = "guest-content/$year:$mon:$mday/$hour:$min:$sec/"; #unless ( system ("mv guest/$dirs[$count]/ $dest" ) ; #){ #} $count++; } print "purging configuration settings \n "; system ("rm -R guest"); print "restoring guest home \n "; system ("mkdir guest"); system ("cp -R default/* guest"); $count = 0; while ($count ne @dirs){ system ("mkdir guest/$dirs[$count]"); $count++; } print "restoring guest account password and ownership details \n"; #system("usermod -p password guest"); system ("chown -R guest:guest guest"); print "done \n"

In reply to Guest Cleanup by Maze

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.