File & Disk Macros
The macros in the sample file_disk_macros.cfg configuration file below are for file and disk management. You would use these for special file and disk management, for example to clear directories, move or delete core files, clear user disks, show disk usage, etc.
/////////////////////////////////////////////////////////////////////////////// // // file & disk management macros // /////////////////////////////////////////////////////////////////////////////// cleartmp(D, T) =find (D) -mtime +(T) -exec =rm {} \; 2>/dev/null /////////////////////////////////////////////////////////////////////////////// clearwebcache(D, T) =find (D) -type f -name cache[0-9]\* -mtime +(T) -print | =grep '\.netscape' | =xargs =rm 2>/dev/null /////////////////////////////////////////////////////////////////////////////// rmcorefiles(D) =find (D) -type f -name core -exec =rm {} \; 2>/dev/null /////////////////////////////////////////////////////////////////////////////// mvrootcore(D) if -e "/core" output mail $command("=file /core 2>/dev/null") output mail $command("=ll /core") =execwait "=mv /core (D)" output mail "moved /core file to (D), after the move:" output mail $command("=dfl / | =behead(1)") endif /////////////////////////////////////////////////////////////////////////////// clearuserdisk(D, T) =clearwebcache((D), (T)); =rmcorefiles((D)) /////////////////////////////////////////////////////////////////////////////// dutop(N, D) // using du, show the top N files/subdirs in directory D // (N) is the number of displayed files/subdirs (e.g., 10) // (D) is the directory (e.g., /tmp); don't enclose with quotes output mail =newline if "(D)" eq "/" do #popen(DU, "=dusk /\* | =sort +0nr | =head -(N)", "r") else do #popen(DU, "=dusk (D)/\* | =sort +0nr | =head -(N)", "r") endif while #read(DU) > 0 output mail $readline endwhile do #pclose(DU) output mail =newline
For more examples, see Samples.