Shell Script to delete files
Joe Nyland
lists at joenyland.co.uk
Sat Apr 20 10:43:53 UTC 2013
On 20 Apr 2013, at 10:31, Nils Kassube <kassube at gmx.net> wrote:
> Akash Jain wrote:
>> My aim is to delete more than 5 days old files which are no longer
>> used by any process. As a starter I have written following script,
>> but it does not work, says line 10 command not found.
>>
>> HOME=~/var
>>
>> cd $HOME
>>
>> for f in `find . -type f`; do
>
> It isn't clear where your script starts, so it is difficult to guess
> which line the shell doesn't like. But I would suggest to carefully
> check the line above.
>
> Nils
Hi,
The following runs with no issues here:
HOME=~/var
cd $HOME
for f in `find . -type f`; do
if [[ `lsof -n $f` ]]; then
echo $f
fi;
done
Hope this helps.
Joe
More information about the ubuntu-users
mailing list