Re: I want all those MP3 files out of my file server

From: Pegasus \(MVP\) (I.can_at_fly.com)
Date: 11/10/04


Date: Thu, 11 Nov 2004 07:31:33 +1100


"Zorpetus" <zorpetus@yahoo.com> wrote in message
news:c51808d3.0411101128.7e7691df@posting.google.com...
> > The script sample I gave you creates one text file for every user's
> > personal share. Isn't this what you require?
>
> Yes! :)
>
> Thank you very much!
> I just have to figure out how to:
>
> a) extend this batch process to some other folder trees (just to add
> one
> more line with that alternate path?)
>
> b) how to run it without anybody logged on (with the help of Command
> Scheduler I guess - but it seems that it needs CMD.EXE as well?).
>
> Thank you very much in advance one more time!!!!

The Task Scheduler is ideally suited for this type of job. There is no need
to invoke an additional Command Processor - just invoke the batch file
itself.

Below is a modified version that lets you deal with any share, whether
personal or otherwise. You simply have to define it in a text file like so:

JSmith$ JSmith PBrown
Finance AWhite PBrown
HR TDean AClinton

The first column is the share name.
The second column is the owner's EMail prefix.
The third column is his supervisor's EMail prefix.

The modified version creates one text file in c:\Logs\Messages for
each share that you deal with. The lines are numbered so that you
can unwrap them properly before removing the numbers. This
version is only partly tested.

1 @echo off
2 set Limit=10000000
3 set Domainl=somecompany.com
4 set MsgFolder=c:\Logs\Messages
5 if not exist %MsgFolder% md %MsgFolder%

6 rem The file c:\Tools\Users.lst contains a list of all users to be
monitored.
7 rem It must be in this format:
8 rem ShareName Owner Supervisor
9 rem e.g. TWhite$ TWhite ABrown
10 rem The first word is the name of the share.
11 rem The second word is the user's EMail prefix.
12 rem The third word is his administrator's EMail prefix

13 for /F "tokens=1-3" %%a in (c:\Tools\Users.lst) do call :CheckSpace %%a
%%b %%c
14 goto :eof
=================================
15 :CheckSpace
16 set total=0
17 set files=0
18 set share=%1
19 set user=%2
20 set supervisor=%3
21 rem The following lines assume that the share is in \\YourServer\JSmith$
(for example)
22 for /F "tokens=1-4" %%a in ('dir /s /-c "\\YourServer\%share%\*.mp3 ^|
find /i "File(s)"') do set files1=%%a & set size1=%%c
23 for /F "tokens=1-4" %%a in ('dir /s /-c "\\YourServer\%share\*.avi ^|
find /i "File(s)"') do set files2=%%a & set size2=%%c
24 for /F "tokens=1-4" %%a in ('dir /s /-c "\\YourServer\%share%\*.wav ^|
find /i "File(s)"') do set files3=%%a & set size3=%%c
25 set /a total=%size1% + %size2% + %size3%
26 set /a files=%files1% + %files2% + %files3%

27 if %total% LSS %Limit% goto :eof

28 echo Note to %user% > %MsgFolder\%Share%
29 echo Copy to %supervisor% >> %MsgFolder%\%Share%
30 echo. >> %MsgFolder%\%Share%
31 echo Server Disk Space Usage >> %MsgFolder%\%Share%
32 echo ====================== >> %MsgFolder%\%Share%
33 echo. >> %MsgFolder%\%Share%
34 echo This is an automatic message from the disk space monitor.>>
%MsgFolder%\%Share%
35 echo. >> %MsgFolder%\%Share%
36 echo You currently store %files% music files on the share "%share%" on
the server.
37 echo These files consume %total% bytes of disk space. >>
%MsgFolder%\%Share%
38 echo. >> %MsgFolder%\%Share%
39 echo Your own words here . . . >> %MsgFolder%\%Share%

40 echo c:\tools\blat . . . %user%@%Domain% . . . %supervisor%@%Domain% . .
. %%MsgFolder%\%Share%



Relevant Pages

  • Re: Compiled ocx file reports different sizes
    ... Rem Set Resource Compiler path ... goto checkMIDL ... echo VC_HOME is set incorrectly. ... echo Step 2: Compiling Resource file ...
    (microsoft.public.vc.mfc)
  • Some batch files for applying MS03-026
    ... find all the Win2k systems. ... the patch to the remote system. ... REM * Author: ... Echo Querying the supplied list for Win2k systems. ...
    (microsoft.public.win2000.security)
  • RE: Help for Windows Vista.
    ... just add a username and password to your command. ... Echo Loggin into our company ... REM *** drev w ... Did you run the Script as Administrator? ...
    (microsoft.public.windows.vista.general)
  • Re: FTP Transfer
    ... echo ftppassword>> FtpScr.txt ... echo bin>> FtpScr.txt ... echo prompt>> FtpScr.txt ... REM files to be transferred are. ...
    (microsoft.public.windows.server.scripting)
  • Re: Rename multiple files?
    ... So Microsoft's wildcards won't let you prefix characters before the wildcard position and apparently retains the length of the substring that it parsed out. ... echo Execute: "%0" ... rem - environment variables, especially needed inside for-loops. ...
    (microsoft.public.windowsxp.basics)