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
# Prints the date on the File
date > ~/cut-usa.com/Shared/clear_shared.log
# Moves to the shared folder
cd ~/cut-usa.com/Shared
# Finds and deletes all files older than 10 days (9 days older than the last 24 hours)
echo "Deleting files older than 10 days:" >> ~/cut-usa.com/Shared/clear_shared.log
find . -mtime +9 -exec rm -fvr {} \; >> ~/cut-usa.com/Shared/clear_shared.log
# Finds and deletes all folders that are empty
echo "Deleting folders:" >> ~/cut-usa.com/Shared/clear_shared.log
find * -type d -exec rmdir --verbose {} \; >> ~/cut-usa.com/Shared/clear_shared.log
# Prints operation concluded to file
echo "Operation Complete" >> ~/cut-usa.com/Shared/clear_shared.log
Now this code outputs none of the results of the "find" commands
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
This is the same of the original (does the job but logs nothing)
Code:
find * -type d -print -exec rmdir >> ~/cut-usa.com/Shared/clear_shared.log{} \;
I ve also tried removing all of the > and >> from the script and running the script like this
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