我意识到这个问题要求使用进行文件大小分析CMD line。但是,如果您愿意使用它,PowerQuery (Excel add-in, versions 2010+)则可以创建一些非常引人注目的文件大小分析。
下面的脚本可以粘贴到空白查询中;您唯一需要做的就是添加一个名为“ paramRootFolderSearch”的参数,然后添加您的值,例如“ C:\ Users \ bl0040 \ Dropbox \”。我以此为指导:MSSQLTips:使用Power Query从文件系统检索文件大小。
该查询为我提供了创建数据透视表([Folder Root]> [Folder Parent (1-2)], [Name])的数据,并且我能够识别出一些可以删除的文件,从而清除了目录中的大量空间。
这是PowerQuery的M脚本:
let
// Parmameters:
valueRootFolderSearch = paramRootFolderSearch,
lenRootFolderSearch = Text.Length(paramRootFolderSearch),
//
Source = Folder.Files(paramRootFolderSearch),
#"Removed Other Columns" = Table.RenameColumns(
Table.SelectColumns(Source,{"Name", "Folder Path", "Attributes"})
,{{"Folder Path", "Folder Path Full"}}),
#"Expanded Attributes" = Table.ExpandRecordColumn(#"Removed Other Columns", "Attributes", {"Content Type", "Kind", "Size"}, {"Content Type", "Kind", "Size"}),
#"fx_Size(KB)" = Table.AddColumn(#"Expanded Attributes", "Size(KB)", each [Size]/1024),
#"fx_Size(MB)" = Table.AddColumn(#"fx_Size(KB)", "Size(MB)", each [Size]/1048576),
#"fx_Size(GB)" = Table.AddColumn(#"fx_Size(MB)", "Size(GB)", each [Size]/1073741824),
fx_FolderRoot = Table.AddColumn(#"fx_Size(GB)", "Folder Root", each valueRootFolderSearch),
helper_LenFolderPathFull = Table.AddColumn(fx_FolderRoot, "LenFolderPathFull", each Text.Length([Folder Path Full])),
fx_FolderDepth = Table.AddColumn(helper_LenFolderPathFull, "Folder Depth", each Text.End([Folder Path Full], [LenFolderPathFull]-lenRootFolderSearch+1)),
#"helperList_ListFoldersDepth-Top2" = Table.AddColumn(fx_FolderDepth, "tmp_ListFoldersDepth", each List.Skip(
List.FirstN(
List.RemoveNulls(
Text.Split([Folder Depth],"\")
)
,3)
,1)),
#"ListFoldersDepth-Top2" = Table.TransformColumns(#"helperList_ListFoldersDepth-Top2",
{"tmp_ListFoldersDepth", each "\" & Text.Combine(List.Transform(_, Text.From), "\") & "\"
, type text}),
#"Select Needed Columns" = Table.SelectColumns(#"ListFoldersDepth-Top2",{"Name", "Folder Root", "Folder Depth", "tmp_ListFoldersDepth", "Content Type", "Kind", "Size", "Size(KB)", "Size(MB)", "Size(GB)"}),
#"rename_FoldersParent(1-2)" = Table.RenameColumns(#"Select Needed Columns",{{"tmp_ListFoldersDepth", "Folders Parent (1-2)"}})
in
#"rename_FoldersParent(1-2)"
文件夹文件Sizes_xlsx.png
文件夹文件Sizes_xlsx2.png