Question

I have a backup harddrive shared (SMB/CIFS) on my local Windows network. Now I need a windows BAT script that deletes some of the shared files in the backup drive. In Linux+bash it would be fairly simple but on a SMB/CIFS shared drive and using only batch scripting I could not find any solutions!

Was it helpful?

Solution

There a few things you can try.First to 'enable' deleting on the share you can first map the drive with net use' : NET USE [driveletter:] \ComputerName\ShareName[\volume] [password | *] [/USER:[domainname]username] [/PERSISTENT:YES]`

And you probably will have access to the files with the DEL command.

If this does not work you'll need to execute the delete via SSH on the unix machine.For this you can use plink: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html The documentation is descriptive enough I think.. And if this does not work too you'll need the heavy weapon -> Cygwin which is also can be used via script to send commands via SSH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top