Koozali.org: home of the SME Server

delete files from remote system

Offline tropicalview

  • *****
  • 196
  • +0/-0
    • http://www.tropicalview.net
delete files from remote system
« 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,

The sky is not the limit, But when I reach the sky, for sure I will not try to go to the limit.... (donated $25,- upto now)

Offline tropicalview

  • *****
  • 196
  • +0/-0
    • http://www.tropicalview.net
Re: delete files from remote system
« Reply #1 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...
The sky is not the limit, But when I reach the sky, for sure I will not try to go to the limit.... (donated $25,- upto now)