ADSM-L

Re: Archiving does not delete directories ???

2004-03-24 11:51:49
Subject: Re: Archiving does not delete directories ???
From: Andrew Raibeck <storman AT US.IBM DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Wed, 24 Mar 2004 09:51:22 -0700
Khalid,

Yes, you could schedule the script with ACTION=COMMAND. However, please
note the following:

- The script is just a sample. In order to be more useful in a production
environment, you should add things like output redirection (to get the
output from the dsmc commands into a log file), and maybe create separate
log information as well (i.e. use the ECHO command to redirect date and
time information to a log file). Also you need to add routines for
handling errors. See http://search.adsm.org and use search criteria

   +raibeck +errorlevel

to find some posts with discussion on this subject, including some example
scripts. You will want to be sure to propagate a nonzero return code back
to the TSM scheduler if any failure occurs in the script (either in dsmc
processing or other areas of the script that are important to you). In
other words, if there is a problem, be sure to exit the script with a
nonzero return code so that the scheduled event will be flagged as Failed
on the TSM server when you use QUERY EVENT.

- The points I raised are valid regardless of whether they are in the
product or scripted as I have described. USE EXTREME CAUTION when
implementing this, as undesirable results may occur. I just noticed
another post from some on this subject that warned against files that may
be moved into the directory structure between the time the archive started
(but the new files do not get archived) and the time the directory
structure is deleted. While the -DELETEFILES option only deletes each file
after it has been successfully archived, the "rd" command in my sample
script is not selective about what it deletes! If I were going to put this
in, I'd be sure improve the "rd" functionality such that it only removes a
directory if the directory has no files in it. Of course, your needs may
vary depending on how controlled an environment you intend to run this in.

Regards,

Andy

Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.ibm DOT com

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.



"Khan, Khalid B." <kkhan AT ATCLLC DOT COM>
Sent by: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
03/24/2004 09:28
Please respond to
"ADSM: Dist Stor Manager"


To
ADSM-L AT VM.MARIST DOT EDU
cc

Subject
Re: Archiving does not delete directories ???






Andy,

Thank you very much for the explanation, your point is well take. Also
thank you for the script.

I suppose I can create a schedule and use COMMAND as the ACTION for the
schedule and use your script to run it. That should work, correct?

Khalid


-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Andrew Raibeck
Sent: Wednesday, March 24, 2004 9:44 AM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: Archiving does not delete directories ???

The -DELETEFILES option was originally designed to operate on files
only,
not directories (as was the original implementation of ARCHIVE). The
-DELETEFILES option is not designed to differentiate between archive of
full trees and archives of partial trees. For example, in which cases
should TSM delete the entire directory structure?

   dsmc archive c:\mydir\*.txt -deletefiles
   dsmc archive c:\mydir\ -deletefiles

What if there are files excluded from the archive via EXCLUDE statements
in your client options file, or a file otherwise fails to be archived?
Should TSM still delete the entire directory structure?

What if there are subdirectories of c:\mydir, but -subdir=yes is not
specified? Should TSM still delete the entire directory structure?

In principle, what you ask is not necessarily unreasonable. It's just
not
something that TSM is set up for (and it is not trivial, as the above
questions suggest). Consider opening a requirement if this function is
valuable to you. If you do open a requirement, it would help if you
could
elaborate on how you think the function should behave in scenarios such
as
those I describe above. That is, under what circumstances should or
should
not TSM presume to delete the directory tree?

In the mean time, you can simulate this function for yourself if you
wish.
For example, the following Windows script can do what you ask (note that
this is only an example, use at your own risk).

REM BEGIN SCRIPT
   @echo off
   if {%1} == {} goto :USAGE

   pushd c:\tsm\baclient

   dsmc archive %* -deletefiles

   if not %errorlevel% equ 0 (
      echo TSM archive function ended with return code %errorlevel%.
      echo Directories will not be deleted.
      goto :END
   )

:TOP
   if {%1} == {} goto :END
   echo.
   echo Deleting directory %1
   rd /s /q %1
   shift
   goto :TOP

:USAGE
   echo Usage: ARCHDEL dir1\ [dir2\ ...]
   echo.
   echo        Example: archdel c:\mydir\
   echo        Example: archdel c:\mydir\ e:\yourdir\ f:\herdir\
   echo        Example: archdel "c:\my directory\ " t:\junk\
   echo.
   echo        Note: When enclosing a directory in quotes,
   echo              put a blank space between the ending
   echo              '\' and the ending quote.

:END
   popd
REM END SCRIPT

Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.ibm DOT com

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.



"Khan, Khalid B." <kkhan AT ATCLLC DOT COM>
Sent by: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
03/24/2004 08:00
Please respond to
"ADSM: Dist Stor Manager"


To
ADSM-L AT VM.MARIST DOT EDU
cc

Subject
Archiving does not delete directories ???






Can someone please explain to me why TSM client does not delete the
directory structure of the archived files? I am using the "deletefiles"
option, but the client leaves the directories on the file system and
successfully deletes the files within those directories.

Is there something I can do to delete the directories together with the
files? Please advise.

Thank you,

Khalid Khan
ATC

<Prev in Thread] Current Thread [Next in Thread>