Hi Colin,
In an ideal world it would be best to upgrade but unfortunately not every company can afford to pay Symantecs rapidly rising prices to keep up to date and so have to manage with what they have got so the work around is really required.
I have now tried two scripts without any success can anyone help at all the scripts are below;
1,
:CONFIGURE
SETLOCAL
PUSHD
::
:: Change the following 3 items below to match your installation.
::
:: * MediaSet - the Backup Exec Media Set Name you're using for backup-to-disk jobs
:: (It's best to make this a name without spaces)
:: * B2Dfolder - the full path to the backup-to-disk folder you're using for the job
:: * BEPath - the full path to the Backup Exec executables (specifically, bemcmd.exe).
:: (If you didn't change it, this is C:\Program Files\Symantec\Backup Exec\becmd.exe,
:: on US English systems)
SET MediaSet=B2D
SET B2Dfolder=F:\
SET BEPath="C:\Program Files\Symantec\Backup Exec\bemcmd.exe"
SET Action=ECHO
SET ActionDir=ECHO
IF /I "%1" EQU "/run" SET Action=DEL & SET ActionDir=RD
IF /I "%1" EQU "-run" SET Action=DEL & SET ActionDir=RD
:PREPARE
:: First, some general cleanup to be sure we're starting fresh
IF BEPath=="" Echo "Cannot find the path to BackupExec! Please edit the command script." & goto End
IF EXIST %B2Dfolder%Media.txt DEL %B2Dfolder%Media.txt
IF EXIST %B2Dfolder%Media1.txt DEL %B2Dfolder%Media1.txt
IF EXIST %B2Dfolder%Media2.txt DEL %B2Dfolder%Media2.txt
IF EXIST %B2Dfolder%Dir.txt DEL %B2Dfolder%Dir.txt
IF EXIST %B2Dfolder%%Del%.txt DEL %B2Dfolder%Del.txt
:: You may need to stop the winmgmt service, because at least in some environments, it keeps
:: handles open to files we may be planning to delete. If necessary, uncomment the following
:: (remove the initial "::" from the line).
:: **** Also uncomment it below (in the CLEANUP section) ***
:: NET STOP winmgmt
:MAIN
:: Now we're ready to delete old files (as long as /run was specified,
:: otherwise we'll just display a list)
:: First, dump a list of all the media labels Backup Exec is currently using. If we can't get this,
:: quit with an error.
%BEPath% -o132 -j%MediaSet% >%B2Dfolder%Media1.txt
IF NOT Errorlevel=1 net send %computername% Error getting listing of Backup Exec B2D Media! & GOTO Cleanup
:: Next, extract all the lines showing an actual in-use media (these will be the backup-to-disk file names)
FINDSTR /c:"LABEL: " %B2Dfolder%Media1.txt > %B2Dfolder%Media2.txt
FOR /f "tokens=3 delims= " %%m in (%B2Dfolder%Media2.txt) do ECHO %%m >>%B2Dfolder%%Media.txt
:: Next, list all the files and folders in the Backup-to-Disk directory.
FOR %%d in (%B2Dfolder%*.bkf) do ECHO %%~nd >>%B2Dfolder%Dir.txt
FOR /d %%d in (%B2Dfolder%*.) do ECHO %%~nd >>%B2Dfolder%Dir.txt
:: Next, find all lines it the list of files that are NOT (/v) in Backup Exec's
:: list of current media. This gives us a list of files to be deleted.
FINDSTR /v /g:%B2Dfolder%Media.txt %B2Dfolder%Dir.txt > %B2Dfolder%Del.txt
:: Finally, execute the required action against each item listed in our Del.txt file
:: from the previous step. Note again that unless you run this script with the /run
:: command-line parameter, it will not delete files but instead just list them.
CD /D %B2Dfolder%
FOR /F %%i in ('findstr /b IMG %B2Dfolder%Del.txt') do %ActionDir% /s/q %%i
FOR /F %%b in ('findstr /b B2D %B2Dfolder%Del.txt') do %Action% /f/q %%b.bkf
:CLEANUP
:: Clean up after ourselves, like good citizens!
:: NET START winmgmt
IF EXIST %B2Dfolder%Media.txt DEL %B2Dfolder%Media.txt
IF EXIST %B2Dfolder%Media1.txt DEL %B2Dfolder%Media1.txt
IF EXIST %B2Dfolder%Media2.txt DEL %B2Dfolder%Media2.txt
IF EXIST %B2Dfolder%Dir.txt DEL %B2Dfolder%Dir.txt
IF EXIST %B2Dfolder%Del.txt DEL %B2Dfolder%Del.txt
ENDLOCAL
POPD
:END@Echo Off
:: A script to delete BKF files and IMG folders no longer needed by Backup Exec.
::
:: Original by Armin Kerl, modifications by Matthew Miller.
::
:: If you have comments or questions, please join the forum and post on the thread at:
::
https://forums.symantec.com/syment/board/message?b...
::
:: Note that this will run properly only on a machine running Windows 2003 or XP SP2 with
:: command extensions turned on (which is the default on those systems).
::
:: History
:: 2008-08-19 AK Original Version
:: 2008-12-31 MM Modified to English, added formatting & comments.
:: Changed to run test only unless /run parameter is specified.
:: Added recursion through B2D subdirectories (since Backup Exec
:: adds \Veritas\B2D to all removable B2D directories on our systems)
2, The second one is a ruby script so I have downloaded and installed ruby as well
#!/usr/bin/ruby
img_dir = ARGV[0]
if ARGV.length > 1 then
testing = true
else
testing = false
end
puts "Deleting from #{img_dir} #{testing}"
curw_dir = Dir.pwd
Dir.chdir(img_dir)
d = Dir.new(img_dir)
d.each do |name|
if File.file?(name)
if name =~ /img000[0-9]*/
if testing
puts "Would delete #{name}"
else
File.delete(name)
puts "Deleted #{name}"
end
else
"Skipping file #{name}"
end
end
end
Dir.chdir(curw_dir)