Hi,
I have a bash script to sort files into "month" folders (I think I broke it now but it used to work)
The problem is that I always forget to run it. Is there a way that I can auto-fill the numbers for the month and the year and get cron to run it on a monthly or weekly bases?
Thanks
Steven
#!/bin/bash# mkdir /var/spool/asterisk/monitor/old-2010-08/find . -maxdepth 1 -type f -name "*201008*" | while read fnamedo mv $fname /var/spool/asterisk/monitor/old-2010-08/done
is it going to cause trouble that the destination folder is within the directory that the script is searching for files?
Should I rather move the destination?
Thanks - I went with Tims with some minor alterations - I added a line so I can manually enter a date - or use the automatic one (it would be better if the automatic one could be last month so that this month's files stay where they are supposed to be - I only realised this after running it)
also fixed a typo
Thanks for the help!
Steven
will get you the date like "201008"
Open in new window