OS: SUNOS 5.10 i386
Hello guys I wrote a shell script in bash shell to delete the files less than 30 days old. The following is the script.
#!/bin/bash
for dirs in `/clu04/oracle/directory_list.lst`
do
find $dirs -type f -mtime -30 -exec rm {} \;
done
=======================================
basically the directory_list.lst is a file containing the list of directories from which the files should be deleted. following are the directories in the directory_list.lst
--------------------------
/clu04/oracle/test_dir1/
/clu04/oracle/test_dir2/
/clu04/oracle/test_dir3/
--------------------------
the following is the error I am getting when I execute the script.
--------------------------------------------------------------------------
/clu04/oracle/directory_list.lst: line 1: /clu04/oracle/test_dir1/: is a directory
/clu04/oracle/directory_list.lst: line 2: /clu04/oracle/test_dir2/: is a directory
/clu04/oracle/directory_list.lst: line 3: /clu04/oracle/test_dir3/: is a directory
--------------------------------------------------------------------------
Now when I exeucte the following script with out the directory_list.lst and the for loop, it works just fine.
#!/bin/bash
find /clu04/oracle/test_dir -type f -mtime -30 -exec rm {} \;
==========================
Can someone please tell me where I am going wrong?
Thank You