Navigation:  Schedule TreeSize Tasks >

Command Line Options

Previous pageReturn to chapter overviewNext page

The Professional Edition of TreeSize accepts command line options which allow you to do scheduled scans or to have the results of a scan on your monitor the next morning. The Schedule dialog will help you to compile a command line with the option below. These option are not available in the Personal Edition.

treesize.exe [/APPENDTOFILES] [/ARCHIVEBITFILESONLY] [/(BAR|PIE)CHART filename] [/COMPARE filename] [/DATE] [/EMAIL] [/EXCEL filename] [/EXPAND [level|xxMB]] [/EXTENSIONSLIST filename] [/FILEAGESCHART filename] [/FILTER pattern1;pattern2;...] [/GROUPSCANS] [/FOLLOWREPARSEPOINTS] [/HTML filename] [/HISTORYCHART filename] [/LISTSEPARATOR char] [/MOVETO (path|ZIP-file|Recycle Bin|Executable)] [/NOGUI] [/NOHEADERS] [/NOUNITS] [/OPEN] [/PRINT] [/SAVE filename] [/SEARCH[:Start [xmlfile]|:Internet] ] [/SIZEUNIT N] [/TITLE text] [/TOPFILESLIST filename] [/TREEMAP filename] [/USERSLIST filename] [/XML filename] Directories
 

/APPENDTOFILES

If this option is used, TreeSize Professional will always append its output to existing files when doing an export using /SAVE.

/ARCHIVEBITFILESONLY

This option will include only files in the scans which have the archive bit set. This option can be very useful if you want to calculate the size of a backup. In this case, you can create a shortcut on your desktop or in your start menu that will automatically start calculating the size of your backup:

treesize /ARCHIVEBITFILESONLY "\\Server\Backup\This"

/BARCHART

Saves the bar chart of the scanned directory to a bitmap, GIF or JPEG file. The file type depends on the extension of the specified file name. This example creates a JPEG image of the bar chart for drive C:

treesize /BARCHART C:\Documents\c.jpg C:\

/COMPARE

Compares the scanned path with a saved XML report. The following example scans drive C: and compares the result with a saved XML report for this drive:

treesize /COMPARE "C:\temp\TSP XML\c.xml" C:\

Alternatively, you can compare two already saved XML reports e.g. "c1.xml" and "c2.xml" by using this command :

treesize /OPEN "C:\temp\TSP XML\c1.xml" /COMPARE "C:\temp\TSP XML\c2.xml"

The /OPEN command prepares the comparison of the two files by expanding the first file (c1.xml into a scan file. The second file ("c2.xml") will be compared to this expanded scan file, just like it would happen, if we would compare c2.xml to a "real" scan.

/CREATEDPASTDAYSONLY

This option will include only files in the scans, which were created during the past number of days, that are given in the argument.

treesize /CREATEDPASTDAYSONLY 8

Here, this option will only include files into the scan, which were newly created during the last 8 days.

It corresponds to the option "Include only Files Created in the Past XX Days" in the Options dialog.

/DATE

This switch will add the current date to all file names occurring after it on the command line. This is useful if you want to do scans regularly every night or every weekend. If you want the date included in all filenames, then /DATE should be your first command line option. The following example will scan the network path \\host\share and save the result to a file like C:\scans\name_03-12-20_1550.xls:

treesize /DATE /EXCEL "C:\scans\name.xls" \\host\share

/EMAIL

Sends the collected data to the given e-mail address using MAPI. Your e-mail application must be configured properly for MAPI. Multiple recipients can be separated with semicolons or commas. Example:

treesize /EMAIL sysadmin@company.com \\SERVER\C$

If MAPI is not sufficient for you, we recommend to save the data to a file and use a command line based mailing tool like the free BLAT.

/EXCEL

Exports the collected data to Excel and saves it under the given file name. If the file name already exists, the file will be opened and a new sheet will be added. The application will terminate itself after saving. Example:

treesize /EXCEL "C:\Documents\c.xls" C:\

/EXCLUDE

This option allows to specify patterns for files and folders that should be excluded from a scan. Multiple exclude patterns can be separated using a semicolon. If one or more of the patterns contain spaces, the complete pattern string must be set into quotes. This command line option is equal to the Exclude list in the Options dialog. The following example will ignore folders that end with ".001" and folders that are named ".system":

treesize /EXCLUDE "*.001;.system" \\server\Users

/EXPAND

This option lets you specify how many levels in the directory tree will be expanded after scanning. If you don't specify a number, all folders will be expanded. Instead of a directory level you can also indicate an amount in MB. In this case all folders larger than the given amount will be expanded. The unit "MB" must follow the number without a blank. The following example will scan the folder "H:\user", expand all folders larger than 10MB and save the result to the Excel file C:\Results\Allusers.xls:

treesize /EXCEL "C:\Results\Allusers.xls" /EXPAND 10MB H:\user

/EXTENSIONSLIST

This option allows you to save the statistics on file extensions / file types of the scanned file system branch to an Excel,  text or CSV file. The following example scans drive C: and creates an Excel file in C:\Temp with the statistics of the file types on this drive:

treesize /EXTENSIONSLIST "C:\temp\C_filetypes.xls" C:\

/FILEAGESCHART

Saves the chart on the "File Ages" tab of the scanned directory to a bitmap, GIF or JPEG file. The file type depends on the extension of the specified file name. This example creates a JPEG image of the bar chart for drive C:

treesize /FILEAGESCHART "C:\Documents\c_file_ages.jpg" C:\

/FILTER

Allows to set a file filter so that only files with certain extensions, e.g. .MP3 or .DOC, will be counted. Multiple patterns may be passed, you can use spaces, commas or semicolons as separator between the patterns. The following example will search for AVI and MP3 files in the users directory on the server:

treesize /EXCEL "C:\Results\MediaUsers.xls" /FILTER "*.mp3;*.avi" \\Server\Users

When performing a File Search, you can also use the /FILTER command line switch to specify the patterns of the Custom File Search. To perform a more complex custom file search save search options to a file and pass the resulting XML file at the command line after /SEARCH.

/FOLLOWREPARSEPOINTS

When adding this switch to the command line, TreeSize Professional will follow mount points and symbolic links when scanning a file system tree.

/GROUPSCANS

Using this command line switch will group all scanned directories under a virtual root folder.

/HISTORYCHART

Saves the chart on the "History" tab of the scanned directory to a bitmap, GIF or JPEG file. The file type depends on the extension of the specified file name. This example creates a JPEG image of the bar chart for drive C:

treesize /HISTORYCHART "C:\Documents\c_history.jpg" C:\

/HTML

Saves the collected data to a HTML file which can be viewed with any HTML browser later.  If you also have a /PIECHART or /BARCHART parameter in your command line, the image will be included in the HTML file. The following example will generate an HTML report for the drive C: and saves it to D:\html:

treesize /DATE /HTML "d:\html\treesize.html" /PIECHART "d:\html\treesize.jpg" C:\

If you would like to scan and export multiple drives or folders, we recommend that you either use one call for each drive or folder, or that you use the command line option like in the following example:

treesize /HTML "d:\html\drive-c.html" /PIECHART "d:\html\drive-c.jpg" C:\ /HTML "d:\html\drive-d.html" /PIECHART d:\html\drive-d.jpg D:\

/LISTSEPARATOR

Allows to define the separator that is used when exporting text or CSV files. Text files use the tabulator by default, CSV-files the list separator from the regional settings of the control panel.

/MOVETO

File Search: Allows to move the results of a file search to a ZIP file, another path, the recycle bin or an executable file. It can only be used in connection with a /SEARCH:Start command line option. To move the files to the recycle bin, specify the name of the recycle bin as seen in the Windows Explorer. The following command will search drive C:\ for internet cache files and move them to a ZIP file called ObsoleteFiles.zip:

treesize /SEARCH:Internet /MOVETO "C:\temp\ObsoleteFiles.zip" C:\

This call deletes the files instead:

Treesize /SEARCH:Internet /MOVETO "Recycle Bin" C:\

This example will use saved search options and move all files that were found on Drive C: to a path E:\Obsolete Files:

Treesize /SEARCH /MOVETO "E:\Obsolete Files" SearchOptions.xml

This example uses previously saved search options with the file name "ArchiveOptions.xml" and passes every matching file path to the batch file "Archiver.BAT" which e.g. may trigger an archiving process:

Treesize /SEARCH /NOGUI /MOVETO "Archiver.BAT" ArchiveOptions.xml

For ZIP-files the /DATE parameter can be used to add the current date to the ZIP file name, See also: Move checked files

/NOGUI

No window will be shown and the application will not appear in the task bar. Useful for background scans. Caution: Use this switch only if you have tested the rest of the command line options because error messages cannot be displayed in this mode. However, it tries to log errors in the event log of Windows. Make sure that this is the first command line switch when using it.

/NOHEADERS

Omits the header lines that are usually written on top of exported files. This makes it easier to get plain data for postprocessing. This option can be used for the File search as well.

/NOUNITS

Omits the units that are usually written after size values. Use /SIZEUNIT to define the unit that will be used, adding /SIZEUNIT 0 will export plain byte values. This makes it easier to get plain data for postprocessing.

/OPEN

Opens a saved XML report on application start. Example:

treesize /OPEN C:\Reports\Drive_C.xml

/OPTIONS

Use this parameter to apply former exported user settings to TreeSize Professional. User settings can be exported at "Tools > Options > Miscellaneous Settings".

treesize /OPTIONS "C:\Temp\User Settings.xml"

/PIECHART

Saves the pie chart of the scanned directory to a bitmap, PNG or JPEG file. The following example will scan the drives C:\ and D:\ and produce a chart for each one in PNG format:

treesize /PIECHART "C:\Temp\c.png" C:\ /PIECHART "C:\Temp\d.png" D:\

/PRINT

Prints a report for the scanned folder to the default printer. The application will be terminated after printing. Usage example:

treesize /PRINT C:\ D:\

/PRINT1

Prints only the first page of a report for the scanned folder to the default printer. The application will be terminated after printing. Usage example:

treesize /PRINT1 \\SERVER\USERS

/RESTRICTED

Starts TreeSize Professional in a "readonly" mode in which the user does not have access to Explorer context menu, may not rename or delete files or folders and the buttons for the Software applet and to connect a network drive are not available in the tool bar.

/SAVE

Saves the results to a text or CSV file after scanning or searching is finished. The application will terminate itself after saving. This example will save the results of the File Search to a CSV file:

treesize /SEARCH:Start /SAVE "C:\Results\c.csv" C:\

/SEARCH

File Search: Opens the File Search window of TreeSize Professional. If ":Start" is added to this command line option, the search is started immediately with the settings used the last time. Files that are added to the result lists will be checked automatically. A previously saved XML file containing settings may be passed, these settings will then be used to perform the search. The next example performs the search with settings that have previously been saved to the file SearchSettings.xml and save the results:

treesize /SEARCH /SAVE "T:\result.txt" SearchSettings.xml

If  ":Internet" is added to this command line option, it will start searching for temporary internet files and delete them. The drives activated during the last regular scan will be scanned, a special set of drives and paths can be specified on the command line (separated with blanks). Usage example:

treesize /SEARCH:Internet

The settings of the last performed file search will be used. However, you can specify the search patterns for the temporary file search using the /FILTER command line option. Tip: You can use the /SAVE command line option to save the results of the file search to a text or CSV file.

/SIZEUNIT N

This option can be used to specify the unit that should be used for displaying size values: N can have the values 0 to 4 which mean: 0 = Bytes, 1 = KB, 2 = MB, 3 = GB. Without this option the value will be used that was set the last when the TreeSize File Search was used.

/TITLE

Can be used to change the title of the printed or exported report. That allows you to supply additional information to the user when using TreeSize Professional in an automated environment.

treesize /TITLE "This is drive C on Server3" /PRINT \\Server3\C$

/TOPFILESLIST

This option allows to save the contents of the Top 100 list to an Excel, text or CSV file.

treesize /TOPFILESLIST C:\temp\C_top_files.txt C:\

/TREEMAP

Saves the treemap as Bitmap, GIF or JPEG-File.

treesize /TREEMAP "C:\Dokumente\treemap.jpg"  C:\

/USERSLIST

This option allows you to save the statistics showing the results grouped by username to an Excel, text or CSV file. The following example scans drive C: and creates an Excel file in "C:\Temp" with the statistics of the users on this drive:

treesize /USERSLIST "C:\temp\C_users.xls" C:\

/XML

Saves the results to a XML file that can be loaded again later and can be used for comparisons

treesize /XML "C:\Results\Allusers.xml" H:\users\

Directories

At the end of the command line, you may pass one or more paths that should be scanned by TreeSize Professional. The wildcards "*" and "?" are allowed. Example:

treesize H:\users\A*

To start one instance for each folder, you may use the Windows for-command like this:

for /D %i in (C:\Windows\S*) do @start /w treesize.exe %i

In case an error occurs,  it will be returned as Windows error code in the exit code of the process. In filenames for the export as well as in the scanned paths environment variables can be used.

Scanning Multiple Directories

If you need to scan multiple directories, it can be a good idea to merge several calls in a Batch file, for example:

"C:\Program Files\JAM Software\TreeSize Professional\treesize.exe" /EXCEL D:\Share1.xls \\Server\Share1

"C:\Program Files\JAM Software\TreeSize Professional\treesize.exe" /EXCEL D:\Share1.xls \\Server\Share1

"C:\Program Files\JAM Software\TreeSize Professional\treesize.exe" /EXCEL D:\Share1.xls \\Server\Share1

 

It is also possible to store the shares that should be scanned in a text file and use the FOR command:

FOR /F "tokens=1"  %%i IN (dir.txt) DO treesize.exe /NOGUI /EXPAND 10MB /EXCEL "c:\temp\%%i.xls" /exclude ~snapshot "\\Server\%%i"

Scheduled Start

You can use the Scheduled Tasks folder of Windows to run TreeSize Professional daily at a certain time, the Schedule dialog of TreeSize Professional will help you setting up a scheduled task.

You can also use the at command to perform scheduled scans. If you for example want to scan the drives C: and E: next night at 03:00 a.m. and save the results to an Excel file, you must enter the following on the command line:

at 03:00 "C:\Program Files\JAM Software\TreeSize Professional\treesize.exe" /EXCEL "c:\temp\tsp.xls" /EXPAND 2 c:\ e:\

If you want to see the results of the file search on your screen when you come into your office in the morning, you should enter something like:

at 06:00 /INTERACTIVE "C:\Program Files\JAM Software\TreeSize Professional\treesize.exe" /SEARCH:Start

Read more about the at command in the Windows help. Error messages occurring during scheduled scans are listed in the Event Log of Windows.

Windows Scripting Host

If you intend to use the Windows Scripting Host (WSH), your command to start TreeSize Professional will look like:

Set Shell = CreateObject("WScript.Shell")
Shell.Run """C:\Program Files\TreeSize Professional\treesize.exe"" /XML c:\temp\drive_c.xml c:\"