Problem logging deleted files older than X
Hey all,
I m in a bit of a sticky situation. I am using a linux ftp server of Dreamhost for my company to exchange files with the outside world, so I want files to be deleted after 10 days, when they have been successfully downloaded by the clients. I m using this script: Code:
#!/bin/bash Here s some other stuff I ve tried: This outputs every folder, not only the deleted ones Code:
find * -type d -print -exec rmdir {} \; >> file Code:
find * -type d -print -exec rmdir >> ~/cut-usa.com/Shared/clear_shared.log{} \; script > file.log but again, nothing, it logs all of the echos but none of the results of the find commands. Can anyone point me in the right direction? Thanks Paul |
Well I think the output of the find command is being swallowed up by the rmdir command. Maybe you could do something like the following:
Code:
#!/bin/bash |
Almost there!!
Hi Ciotog,
thanks for the help, it now works, but the log file simply skips everything before find * -type d -fprint $LOG -exec rmdir --verbose {} \; (the 3rd last line), I m guessing the -fprint command does a > rather than an >> Is there any way to append to the file rather than overwrite it? Thanks a mil! Paul |
I think this should work:
Code:
find * -type d -print -exec rmdir --verbose {} \; >>$LOG |
Works like a dream, of course how dumb of me... print out but not to file, then output the result of the command to file...
Doh!!! Thanks :D |
All times are GMT -5. The time now is 06:45 AM. |