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!
Asked
Active
Viewed 1,289 times
0
-
The files are accessible only via the share? – npocmaka Nov 02 '12 at 18:58
-
no, I can enable FTP access but I'd prefer to keep it disabled. However if you've got a solution involving FTP it would be appreciated as well. – Gianluca Ghettini Nov 02 '12 at 21:08
1 Answers
1
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

npocmaka
- 55,367
- 18
- 148
- 187