Koozali.org: home of the SME Server

Obsolete Releases => SME 7.x Contribs => Topic started by: tropicalview on September 30, 2008, 04:16:29 PM

Title: delete files from remote system
Post by: tropicalview on September 30, 2008, 04:16:29 PM
Dear all,

I want to delete files from a remote system.
i'm now talking over deleting files from a NAS device that i use for the DAR2 backups.

When the DAR2 deletes the old files it gets to a other folder called "Trash can"

With DAR2 i already access the device using:
file system: CIFS
Username + Password.

My question is, how can i create a batch file, that will mount this drive (using username and password)
Delete all files from the folder trash can
unmount the drive.


Hopefully someone will be able to guide me trought this.

Kind regards,

Title: Re: delete files from remote system
Post by: tropicalview on September 30, 2008, 11:17:00 PM
Hi,

THis is already solved.
 I created a .sh file with this:

Code: [Select]
mount -t cifs //192.x.x.4/share -o username=admin,password=xxxxx /mnt/hkroon
cd /mnt/hkroon/trashbox/xxxxxx/daily
NOWDATE=`date +%y%m%d`
ls -s -1 > $NOWDATE.txt
rm *.dar -f
ls -s -1 > $NOWDATE-a.txt
cd /
umount -l /mnt/hkroon

and i placed it in a daily contab by the contrib http://wiki.contribs.org/Crontab_Manager

now i have to run some days to see if it works...