|
| |||||||||
| Tags: batch, csv, directories, export |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Batch file to list directories, export to CSV
Good morning: A while ago I had a batch file I put together with a little help from some tutorials to scan through a list of directories kept in a separate TXT file, echo the size of each directory on the screen, and also echo them out to a CSV file (DIRECTORY,SIZEinBYTES). I'm using it to do a quick poll of the size of users personal folders on our network share, so first it would map the root of the shar drive as Z: \, then it would go through each one in the list I created and give the size of all the data contained in that directory. Can anyone point me to a website with this code? I've been on Google all morning but can't find the website I used. |
|
#2
| |||
| |||
| Re: Batch file to list directories, export to CSV
On Feb 16, 9:50*am, chickenfriedsteak <ow...@chickenfriedsteak.us> wrote: > Good morning: > > A while ago I had a batch file I put together with a little help from > some tutorials to scan through a list of directories kept in a > separate TXT file, echo the size of each directory on the screen, and > also echo them out to a CSV file (DIRECTORY,SIZEinBYTES). *I'm using > it to do a quick poll of the size of users personal folders on our > network share, so first it would map the root of the shar drive as Z: > \, then it would go through each one in the list I created and give > the size of all the data contained in that directory. > > Can anyone point me to a website with this code? *I've been on Google > all morning but can't find the website I used. Just a minute after I posted this, I found what I was looking for. For anyone interested: @echo off set servlist=c:\serverlist.txt if not exist %servlist% echo %servlist% not found & pause & goto end set listfile=c:\dirsize.csv for /f "tokens=*" %%a in (%servlist%) do call :process %%a goto end :process for /f "tokens=3" %%x in ('dir %1 /-c/s ^| find "File(s)"') do set total=%%x echo %1, %total% echo %1, %total% >> %listfile% :end |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Batch file to list directories, export to CSV" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| scripts to list all users, home directories, and their home directories sizes | ngwodo | Technology & Internet | 3 | 16-07-2011 04:03 AM |
| make file name list in excel using batch file | shibinpanayi | Windows Software | 1 | 04-06-2011 04:44 AM |
| code for using a batch file to parse html (.htm) files and export values in .csv format | jamesnovello | Software Development | 1 | 19-03-2011 02:28 AM |
| run Batch-file export in excel (its for a Movie database) | rayg | Software Development | 4 | 22-12-2010 08:31 PM |
| Batch file to compare directories | Lauren Ambrose | Software Development | 5 | 31-03-2010 12:08 PM |