1 2 Previous Next 22 Replies Latest reply on Sep 5, 2013 9:37 AM by Jim Wilson

    Folder size report

    Joe Piotrowski

      I have a customer who has an FTP site on a Windows server. Every week they want to run a job that finds the size of a folder, and email that folder size to one of their clients. Right now they are navigating to the folder, getting the Properties of the folder (which shows the number of Files and the Size), taking a screen shot, and emailing the customer with that information.

       

      They are running BSA/BDSSA 8.2.02 and wanted to know if we could automate this entire process. Either through BSA or BDSSA. Any ideas?

        • 1. Re: Folder size report

          In this case I am assuming : I have one unix server from which I will set the crontab job which will log-in to the ftp server that is a windows box

           

          we can use the below shell script and set it in crontab to get the data

          ===============

          #! /bin/bash

          server= abc.example.com

          echo "FTP in Windows Server" | mail -s " FTP in Windows Server" name@example.com

          ftp $server  ( we can put the machine name, user name and password in .netrc file on the linux box to authenticate)

          ftp>prompt

          ftp>get c:\test.txt

          ftp>bye

          cat test.txt | mail -s "size of the directory" name@example.com

          ================

           

           

           

          now in the ftp box(having windows os) we can schedule a job which will run a batch file and pull out the data from the location and generate a text file and keep in a perticular location. The content of the batch file would be:

          ==========

          @echo off

          dir c:\folder_name > c:\test.txt

          ==========

           

          hope this help. check and let me know if you have security concern regarding the script keeping in windows box, then we will think alternately.

          • 2. Re: Folder size report
            Bill Robinson

            yeah - that doesn't make a lot of sense to do.  you should just need an EO that gets the folder size by running an OS command to show this, then take a snapshot of that.

            • 3. Re: Folder size report

              Hello Bill,

              Thanks for your comment.

              what do u mean by EO?

              and why should we perform all 3 steps(running script to get the data==> take the snashot ==> send it to the mail id)) when it can be automated in a single shell script from nsh..?? could you  please elaborate? r u finding any security concern here or anything?please suggest.

              • 4. Re: Folder size report
                Siddu angadi

                EO is extended object used to trigger some commands and store into readable output as configuration file.

                 

                Refere the link for more information about it:  https://docs.bmc.com/docs/display/public/bsa83/Creating+an+extended+object

                • 5. Re: Folder size report
                  Bill Robinson

                  well - it depends what you want to do.here - if you want to just get the info then a nsh script may be ok.  if you want to incorporate this into the bdssa reporting then you would need a snapshot.  you could also use the EO/snapshot to do some change tracking/auditing to see if things are changing day to day.

                  • 6. Re: Folder size report

                    Thanks Bill, it is now crystal clear..

                    • 7. Re: Folder size report
                      Joe Piotrowski

                      Thanks for the responses. I'm trying to find the simplest way to do this. I wasn't sure if all of it could be done within BSA leveraging it's email capability. But I wasn't sure if I could create a job within BSA that also contained the results I wanted contained in an email.

                       

                      I can do a "dir /s" in Windows which lists all files/folders with a summary at the end:

                           Total Files Listed:

                                 108241 File(s) 25,200,339,284 bytes

                                 72294 Dir(s)  97,160,220,672 bytes free

                       

                      But that information is different than what I see viewing the Properties if that folder:

                           Location:

                           Size:

                           Size on disk:

                           Contains:

                       

                      So I'm not really sure the best way to go about this.

                      • 8. Re: Folder size report
                        Bill Robinson

                        Powershell ?

                        • 9. Re: Folder size report

                          what exactly you need..the 1st one as an output or the 2nd one..??

                          • 10. Re: Folder size report
                            Joe Piotrowski

                            It's a folder on an FTP server. So the customer wants a weekly report on how much space the folder is taking up, and (if possible) how much space is left. But I think the primary need is the total size of the folder and its contents.

                            • 11. Re: Folder size report

                              then only '>$ dir folder_name > output.txt' command will work  perfectly

                               

                              it will give you the total size of the folder as well as the total number of files individually..and send the details to output.txt file..which you can automate as the mentioed early..

                              • 12. Re: Folder size report
                                Neha B

                                Hi Joe,

                                Even I am facing the same issue, did you create the extended object? If created, could you please tell me the command you used.

                                • 13. Re: Folder size report
                                  Joe Piotrowski

                                  I just had a chance to revisit this. Let me be a little more clear. When I do a "dir /s" in Windows I get the following output:

                                   

                                  ...

                                  07/13/2009  09:17 PM             7,168 fms.dll.mui

                                  07/13/2009  09:17 PM            10,752 mlang.dll.mui

                                  07/13/2009  09:17 PM            37,376 msimsg.dll.mui

                                  07/13/2009  09:17 PM             3,072 msprivs.dll.mui

                                                 7 File(s)        144,896 bytes

                                   

                                  Directory of C:\Windows\system32\zh-HK

                                   

                                  07/13/2009  11:20 PM    <DIR>          .

                                  07/13/2009  11:20 PM    <DIR>          ..

                                  07/13/2009  09:17 PM             4,608 comctl32.dll.mui

                                  07/13/2009  09:17 PM            41,472 comdlg32.dll.mui

                                  07/13/2009  09:17 PM             7,168 fms.dll.mui

                                  07/13/2009  09:17 PM            11,264 mlang.dll.mui

                                                 4 File(s)         64,512 bytes

                                   

                                  Directory of C:\Windows\system32\zh-TW

                                   

                                  07/13/2009  11:20 PM    <DIR>          .

                                  07/13/2009  11:20 PM    <DIR>          ..

                                  07/13/2009  09:17 PM            40,448 cdosys.dll.mui

                                  07/13/2009  09:17 PM             4,608 comctl32.dll.mui

                                  07/13/2009  09:17 PM            41,472 comdlg32.dll.mui

                                  07/13/2009  09:17 PM             7,168 fms.dll.mui

                                  07/13/2009  09:17 PM            11,264 mlang.dll.mui

                                  07/13/2009  09:17 PM            36,864 msimsg.dll.mui

                                  07/13/2009  09:17 PM             3,072 msprivs.dll.mui

                                                 7 File(s)        144,896 bytes

                                   

                                       Total Files Listed:

                                             10488 File(s)  1,979,838,602 bytes

                                              2772 Dir(s)  30,835,937,280 bytes free

                                  • 14. Re: Folder size report
                                    Joe Piotrowski

                                    As you can see, there could be thousands of lines of text. But I only care about the last two lines at the end. How can I create an Extended Object that captures just the last two lines?

                                     

                                    If I get that I'm assuming I can create a Snapshot Job of the EO, create a report in BDSSA, and have that report emailed weekly.

                                    1 2 Previous Next