windows - Index all files and folders under E:\data using batch file -
windows - Index all files and folders under E:\data using batch file -
i want write batch script create csv or json file containing file , folders under e:\data. informations need store (file or folder name, size, type--file or folder, total location path).
any help appreciated. give thanks you.
powershell can ease. have add together little subexpression give friendly terms if folder or file. otherwise rid of entire @{l=...}
bit , utilize psiscontainer , true/false state if folder or not.
get-childitem e:\data -recurse | select name,length,@{l='type';e={if($_.psiscontainer){'folder'}else{'file'}}},fullname | export-csv c:\path\to\output.csv -notype
or, if want find out folder sizes of folders (including files in folder) run this:
| select name,@{l='size';e={if($_.psiscontainer){$_.getfilesysteminfos()|measure -sum -property length|select -expand sum}else{$_.length}}},@{l='type';e={if($_.psiscontainer){'folder'}else{'file'}}},fullname | export-csv c:\path\to\output.csv -notype
windows powershell batch-file command-line command-prompt
Comments
Post a Comment