Saved Bookmarks
| 1. |
Solve : Collect the share folder and file path and disk size usage? |
|
Answer» Dear All, I want to use the batch to collect share folder Is this a mapped drive? How is the server accessed? Does it require authentication for the user? Quote My format is one column What kind of MB do you expect? 1,000,000 bytes = 1 MB ? If the number of files and folder over a LAN are huge, then this could be a very slow task. Have you considered that?Yes, MB = 1 MB capacity in MB Just want to check the number of folder on the share drives Let me take example , I have the server to be share HOME Drive I want to get some information how many folders and files are in the home drive. How many those files and folders in usage I just want to know the script or command in window I use diruse to get such information , but it is not enough Do you access the drive with a drive letter? EG: do you use H: to access the home drive? Can you give an example of the output you need, showing a few lines of numbers etc? Does it need to be formatted in a special way with tabs or padded columns etc?I just UPLOAD the result layout for your reference I use diruse and dir /s/b /a:d to search total no. of files, share drive usage and no. of folders and subfolders information. I m admin so I can access all the share drive. I run the command on the target server to get such information. Thank you [attachment deleted by admin to conserve space]The answers you've given to my questions are unclear, and not really what I've asked. The task should be fairly easy, but without the info I have asked you for - you may come back and say it doesn't work or you want something different - and it's no fun having to do things twice just because the task isn't well described. Nowhere has an excel file been mentioned...Hi I use the share drive on D:HOME I just want to get the such spreedsheet information by script. diruse ; Show the total size of folder and number of files but not show to number of subfolder Size (mb) Files Directory 24.18 102 C:\SUPPORT_TOOLS 3.20 3 C:\SUPPORT_TOOLS\ProcessExploreNT 27.38 105 SUB-TOTAL: C:\SUPPORT_TOOLS dir /s/b/a:d : Show the number of folder and subfolders as well C:\support_tools\ProcessExploreNT dir /s/b /a:d 27.38 105 TOTAL: C:\SUPPORT_TOOLSYou can have the data in a .csv file This is not thoroughly tested - see how it works for you. Code: [Select]echo off ( echo TOT_FOLDERS,TOT_FILES,TOT_SIZE,FOLDER rem parse each folder for /f "DELIMS=" %%a in ('dir /a:d /o:n /b /-p') do ( rem collect files for /f "delims=" %%b in ('dir "%%a" /b /s /-p /a-d ^|find /c /v ""') do ( rem collect folders for /f "delims=" %%c in ('dir "%%a" /b /s /-p /ad ^|find /c /v ""') do ( rem collect total size for /f "tokens=2,*" %%d in ('dir "%%a" /s /-p ^|find " File(s) " ') do set totalsize=%%e setlocal enabledelayedexpansion echo %%c,%%b,"!totalsize!","%%~fa" endlocal ) ) ) )>"total.csv" Thank you for your effort to build the code for me I check the output , it can't show the total file size and folder size May I know is it something wrong on the command [attachment deleted by admin to conserve space] Quote from: sun_os on March 28, 2015, 11:19:56 PM Thank you for your effort to build the code for me I'm guessing that your Windows is not an English build. This is what I see here in a test: TOT_FOLDERS,TOT_FILES,TOT_SIZE,FOLDER 0,8,"11,796,480 bytes","d:\Backup\Vox\Images" 21,58,"52,505,656,317 bytes","d:\Backup\Vox\Machines" Hi, My domain window are built in the English version Quote from: sun_os on March 29, 2015, 07:59:09 PM My domain window are built in the English version I'm afraid I don't know what your domain window is. On the computer you are launching the batch script on, please open a cmd prompt and type the command dir and then copy and paste the bottom 12 lines or so into a reply - so I can isolate where the problem is.I run the bat file on the server, it can get the result, but the some share folder contain chinese file name and long file name. It outputs the file is too long. It is not my expectation for such situation on the END users to save in long chinese file name Sorry I don't mention that ISSUES from share drive [attachment deleted by admin to conserve space] |
|