I want all those MP3 files out of my file server

  • Thread starter Thread starter Zorpetus
  • Start date Start date
Zorpetus said:
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%
 
I don't think anyone disputes the idea that a backup is faster if the
files are not there to process, even when excluding them.
We agree, then..


And I wish that people would read the question before posting a smart-
ass reply like yours. The problem is that there was no simple means to
offer a DELETE solution for the OP, and since his question also
mentioned time as being critical, the exclusion method IS the fastest
method anyone has presented to him.
You are totally right. I was assuming that we were talking about a
more general case. I conviced myself that people were essentially
saying, leave the files on the server, just exclude them, don't bother
with deleting them. I see now that that was wrong.
Sure, it would be nice to delete the offending files first, but I don't
see you offering a solution down that road - all I see is you
complaining about people that provided him a solution to decrease his
backup time based on what he has available.
OK, there were solutions offered. It is true that I didn't offer one.
For what it is worth, in a similar situation I provided an old server
and a hard disk and said to put them there. But the risk of getting
illegal stuff getting on there meant that I had to take it down.
As for you incorrect assumption that we don't do/try these things before
posting, well, you're wrong.

I offered a DELETE solution, but that would also delete any valid MP3
files. Several of us offered a exclusion solution, which would decrease
the backup size and decrease the backup time. You've not offered
anything but criticism.
We had a number of old servers, holding mp3s, and for running evening
UT tournaments and stuff like that. Such a solution could work for
him. Unfortunately we had to take them down, as I said.

Cheers,

Cliff
 
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.


OK, will try it. Last time I used it - it was NT4.0, and AT command,
and I remember that CMD.EXE should be invoked as well. Glad to hear that
things are much better now.
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:

Thank you very much for you time.
Really!

I will try this and let you know (here in the newsgroup) about
results.

My users shared folders aren't shares themselves:

so John Smith, has his private folder like:

\\server\private\jsmith

and only \private is being shared (as \\server\private)

Users sub-folders are not being shared.

But, I have a plenty of other shares like \\RDMARK (shared between
R&D and marketing etc.) so this could be very useful.


Again, thank YOU VERY MUCH for your time, and I will test this and
let you know about the results.
 
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%

It works! :-)))

We some slight modifications and customizations I made it work! :-)
Trick was also to save this as RUN_ME.CMD (not .BAT). For some reason
it works better with task scheduler in Windows 2000 (?).

Thank you very, very, very much for your help!!!
 
Zorpetus said:
It works! :-)))

We some slight modifications and customizations I made it work! :-)
Trick was also to save this as RUN_ME.CMD (not .BAT). For some reason
it works better with task scheduler in Windows 2000 (?).

Thank you very, very, very much for your help!!!

Thanks for the feedback.

The accepted wisdom about .cmd files is that they were created
for WinNT/2000/XP in such cases where they contain code that
will not run under Win9x. The command test.cmd, invoked under
Win9x, will obviously not run. Under WinNT/2000/XP, there is
not difference between the two. If you think you have found a
difference then yoiu will probably go down in history as the first
person to realise that there is a difference between .cmd and .bat
files!

However, I suspect that there is something else that caused the
different behaviour.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top