Hi
I'm trying to remove files and directories of a specific date. I have several backup files which are created on the same day, which I have to delete all together.
I'm running this command to get the date of the oldest file, then using
this date delete all files with this date ignoring the time.
Code:
ls -lastr *.bkf | head -1 | awk ' { printf "%s %2s\n",$7,$8 } '
This gives an output of Month Day
If I assign this to a variable in a csh or echo the above between two `
The padding space seems to be removed in the string.
For example
becomes
and therefore doesnt match the ls -lastr command for example-
Code:
4196384 -rwxrw-rw- 1 ftp wheel 4294980608 Dec 3 06:12 B2D000001.bkf
I'm a bit of a newbie in scripting and I'm sure theres either a
simple syntax change or a much better way of doing this.
Any help much appreciated (I'm losing my hair over this one..)