Hi guys, i need to write this script for school, and i really need help , i would appreciate it if anyone could help me.
For a users home directory, the program will calculate the amount of disk space their directory is using on the system. If space falls below a certain limit, create a warning message and have the system list all files and directories where the system will prompt the user :
a) to delete files (system does not delete files but archives and compresses them instead)
b) to delete directories ( system does not delete files/directories but archives them and compresses them instead)
c) To restore files
d) to restore directories
e) if the user does not chose any of the options above, have the system automatically archive and zip files and / or directories that are more than 30 days old
f) after 60 days display a message to the user that these old files (30 days old) will be permanently deleted from the system. give the user the option to restore these old files.
Implement the appropriate logic so that if the user wants to restore files and there is no space left on the system, the user will have to permanently remove files and directories to create the appropriate amount of space.
this is what i got so far, which will tell how much space he has ..
PHP Code:
#!/bin/sh
CURRENT_DIR=`echo $cwd`
cd
cd ..
LAST_LINE=`du $user | tail -1`
SPACE=`echo $LAST_LINE | awk '{print $1}'`
echo "My home directory is using $SPACE kilobytes."
cd $CURRENT_DIR
thanks again