mphayesuk
25th June 2006, 16:13
Ok what I want to do is get the size of a file and then assign that size to a variable.
This is what I have so far:
echo "total size of file"
ls -l -s /tmp/systembackups/$Today/$Today/systemfiles.tar.gz | cut -d \ -f 7
the $Today variable is the date that the backup script was run, so every night when the script runs it tar's everything up and then burns to a dvd, what I also have is all the output from my script goes into a log file, so at the end of the log file I want to put the file sizes of the backup.
With the example above I have tried to assign it to a variable and get nothing, when I try and run it as an echo statement it wont recognise the $Today variable.
Can anyone help with this.
Thanks
This is what I have so far:
echo "total size of file"
ls -l -s /tmp/systembackups/$Today/$Today/systemfiles.tar.gz | cut -d \ -f 7
the $Today variable is the date that the backup script was run, so every night when the script runs it tar's everything up and then burns to a dvd, what I also have is all the output from my script goes into a log file, so at the end of the log file I want to put the file sizes of the backup.
With the example above I have tried to assign it to a variable and get nothing, when I try and run it as an echo statement it wont recognise the $Today variable.
Can anyone help with this.
Thanks