Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to move my files from Win 7 to my FreeNAS box. I keep getting errors because my path is too long and some files dont get transferred because it has special characters like the character accents. Some files do get transferred but the file name changes. ie. "é" -> "_".

I am trying to prevent this. What software can i use to scan the given directory for long path names and file names that have invalid characters?

share|improve this question

1 Answer 1

This powershell script will scan a folder and print all files and folders not containing a set of characters or is above a given length:

$path="Q:\Test";
$length=55;
$legalChars="^([a-z0-9\.\-_ ])+$";

Get-ChildItem $path -recurse | %{ 

    if(($_.Name).length -gt $length)
    { 
        write-host $_.FullName
    }
    elseif($_.Name -notmatch $legalChars)
    {
        write-host $_.FullName        
    }
}

Edit: It now only tests the length of the filename, not the entire path length, change the first if-condition from .Name to .FullName to test path length instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.