I think I got it worked out. It goes a little like this: set MONTH=%date:~4,2% if (%MONTH%) == (01) set ARCHFOLDER=m09 if (%MONTH%) == (02) set ARCHFOLDER=m10 ... etc. for all 12 months net use W: \\IP_address\vol0 /user:username password W: FOR /F %%d IN ('dir /s /b %%ARCHFOLDER%%') DO (C:\path\dsmc arch %%d\* -optfile=C:\path\dsmarch.opt -subdir=yes -deletefiles) C: net use W: /delete
It's all been tested, except for the -deletefiles parameter - waiting for the customer's OK on that one. The fact that it has to open a new TSM session for every directory slows it down a bit (hundreds of these directories, at an extra 3-4 seconds per new TSM session), but it gets the job done. Had some trouble initially running the dsmc from the W: drive (ANS0101E), but fixed it by defining the DSM_DIR system variable. Robben Leaf From: Robben N Leaf/MN/USB To: "ADSM: Dist Stor Manager" <ADSM-L@VM.MARIST.EDU> Date: 01/22/2009 01:42 PM Subject: Re: [ADSM-L] Archive script for selected directory names That might work, if there weren't also other, non-log files and directories on that share that are older than 90 days, that we do NOT want archived and deleted. But it's worth keeping in mind. Thanks for the suggestion! Robben Leaf From: Shawn Drew <shawn.d...@americas.bnpparibas.com> To: ADSM-L@VM.MARIST.EDU Date: 01/22/2009 11:57 AM Subject: Re: [ADSM-L] Archive script for selected directory names Sent by: "ADSM: Dist Stor Manager" <ADSM-L@VM.MARIST.EDU> Instead of trying to deal with the naming convention of the directories, I would create an archive file list by simply doing a file search for any file/directory that is older than 90 days. I'm sure you can find a windows version of "gnu find" that can do this. Regards, Shawn ________________________________________________ Shawn Drew Internet robben.l...@usbank.com Sent by: ADSM-L@VM.MARIST.EDU 01/22/2009 12:34 PM Please respond to ADSM-L@VM.MARIST.EDU To ADSM-L cc Subject [ADSM-L] Archive script for selected directory names Hello All, I've got a customer who uses a NAS as a repository for various log files from many servers. These log files are organized by server, then by year and month in the directory structure on the file space. For example, any log file from July of 2008 will be in a directory called ...\servername\y08\m07\. New servers will have their logs added to this share without notice, in various places on the directory tree, but the log directory naming convention will be consistent. This customer requires monthly archives of all log files that are older than 90 days. Once archived, the log files will be deleted - sort of a poor man's HSM. The -deletefiles parameter in the TSM ARCHIVE command will work for this. Note: NDMP does not support archives, or backups of specific selected data, so this must be done via CIFS or NFS - I've got that covered. Due to corporate standards, the archive job will not be scheduled with TSM, but rather with a third-party solution (Autosys). I'm trying to write a script (a Windows batch file) that will figure out what month it is and archive all - and only - the directories for the log files from 4 months ago. The problem I'm having is that the ellipses wildcard (\...\) for directory specification cannot be used in the ARCHIVE command itself - it can only be used for INCLUDE and EXCLUDE statements in the option file. I can compensate for this by having the script rewrite the option file each month with the right includes and excludes, but then the ARCHIVE command gets effectively run from the command line - overriding the option file's includes and excludes, even using INCLUDE.ARCHIVE and EXCLUDE.ARCHIVE. I can't figure out a way to get the ARCHIVE command to do its archives on only, and all, the directories from one specific month. This doesn't necessarily have to be done from a Windows server, though I'm not real speedy with my unix shell scripting. Any suggestions? Thanks in advance! Robben Leaf U.S. BANCORP made the following annotations --------------------------------------------------------------------- Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation. ---------------------------------------------------------------------