Mombu the Microsoft Forum

Go Back   Mombu the Microsoft Forum > Microsoft > Scripting newbie, please help..
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 30th October 05:51
jeff pancrazio
External User
 
Posts: 1
Default Scripting newbie, please help..



I am looking for a script that does lots of things, Here goes..

1. Reads a servers.txt file
2. Reads a exclude.txt file
3 Then deletes a file type, lets say mp3 file that are two years old
from todays date

So i have 30 servers (servers.txt), that i need to scan the drive for
and look for say mp3 files, that are 2 years old except for maybe
a1.mp3 and a2.mp3, etc (exclude.txt), Does anyone know of a script or
point me in the right direction? thanks!.
  Reply With Quote


 


2 30th October 05:51
pegasus \(mvp\)
External User
 
Posts: 1
Default Scripting newbie, please help..



You have a couple of choices:
a) You write a script file that recursively creates a snapshot of all
.mp3 files on a remote disk, then deletes all those that are older
than two years except for those nominated in the exclusion list.
It will take quite a few lines of code and a matching amount of
debugging time to do this; or
b) You build on the work that someone else has done.

Here is batch file that relies on Option b). It relies on 8 lines
of code.
@echo off
set Exclusions=c:\Exclude.txt
set Servers=c:\Servers.txt
set Age=730

for /F %%a in (%Servers%) do (
echo Processing server "%%a"
ping %%a | find /i "bytes=" || goto :eof
xxcopy \\%%a\c$\*.mp3 c:\dump\ /s /db#%Age% /rs /ex%Exclusions%
)

This version prompts you for your permission to delete the
chosen files. When you are confident that it does the right
thing, replace the last line in the code above with this line:

xxcopy \\%%a\c$\*.mp3 c:\dump\ /s /db#%Age% /yy /rs /ex%Exclusions%

You must put your server names into c:\Servers.txt, one name
per line. Your exclusions go into c:\Exclude.txt, one exclusion
per line. You can download xxcopy.exe from a number of sites.
  Reply With Quote
3 18th November 07:18
jeff pancrazio
External User
 
Posts: 1
Default Scripting newbie, please help..


Thank You!... Sorry it has been so long since i replied.. this worked
well..
  Reply With Quote
4 18th November 07:18
pegasus \(mvp\)
External User
 
Posts: 1
Default Scripting newbie, please help..


Thanks for the feedback.
  Reply With Quote
Reply


Thread Tools
Display Modes




666