I have a couple of huge zip files I need to report on. This was an
extraction from a legacy db. There are multiple sub directories and the
names are longer than 256 characters so winzip truncated the names.
(don't ask why ). I need to report on which names were truncated and the directories. I am using windows 7.
The report should have the full path and file name of truncated files and a second report of all file names.
I was thinking of finding the truncated names either by length or a file that does not have an extension.
I was able to get this much done in PowerShell ISE:
cd "C:\BI"
$name="test";dir -r|%{File name:{0} - Extension:{1} };$name
$len=0;dir -r|%{if ($_.FullName.Length -gt $len) {$len=$_.FullName.Length}};$len
$folders = "C:\BI"
foreach($folder in $folders){
foreach($file in (dir -Recurse $folder)){
$file
$length += $file.length
}
Write-Host ($length)
$length = 0
}
Results: Directory: C:\BI
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 10/23/2012 1:12 PM 1064723 deploy.pptx
-a--- 5/14/2013 3:46 PM 686 DirLoop.ps1
-a--- 5/14/2013 3:45 PM 1282 FileManipulation.ps1
-a--- 5/14/2013 2:28 PM 448 lengthcheck.ps1
-a--- 10/19/2012 2:28 PM 187392 Request Form.doc
but I want the length of directory and filename and list only if it is over 256...... arg
Thanks for any help!
↧
How to create a list of files Zipped
↧