Solved

Util to search for invalid file or folder names

Posted on 2014-10-21
8
218 Views
Last Modified: 2015-02-08
I'm looking for a util, a free util that is. that will search a folder structure and check all of the file and folder names for invalid characters and give those path names - could save it in text document - back to user.

Now I could probably write this myself.  (Hint: use the dir command and pipe results to text file and then go through the text file line by line and check each character) but I'm feeling lazy and someone might know of such a util and gain themselves points.

All this is to stop robocopy or my Linux server making noises when they come across these file or folder names.
0
Comment
Question by:dbrunton
8 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 40396264
Do you have a list of characters you would like to filter for ?


you  could do this in powershell easily
gci c:\folder -recurse | ? {$_.Psiscontainer } | % {if ($_.name -like "*characters*") {$_.name | out-file c:\report -append}}

Open in new window

0
 
LVL 48

Author Comment

by:dbrunton
ID: 40405256
Hmm.

I'll have to do some experimenting.
0
 
LVL 53

Assisted Solution

by:Joe Winograd, EE MVE
Joe Winograd, EE MVE earned 100 total points
ID: 40405374
Hi dbrunton,

The following characters are not allowed in windows folder/file names:

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
Integer value zero (ASCII NUL character)
Integer values 1-31 (except for alternate data streams where these characters are allowed)

On the other hand, Unix/Linux allows everything in file names except "/" (forward slash) and integer value zero (ASCII NUL character). So I guess the issue is that you have files created on your Linux server that have characters in the file name which are valid on Linux but invalid on Windows. The reverse is not possible, that is, you can't create a file/folder name in Windows that Linux would consider invalid. So I would think that your comment "this is to stop robocopy or my Linux server making noises" could only be half true — if I'm understanding this right (and I may not be), I don't see how the Linux server could be making noises about file/folder names — only Windows should be making noise. Right? Regards, Joe
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 29

Accepted Solution

by:
becraig earned 400 total points
ID: 40405379
0
 
LVL 48

Author Comment

by:dbrunton
ID: 40405406
Yep, it is the Windows box complaining I believe.  Not confirmed.  There's a low beep noise from somewhere.

Oohh, I'll be looking at that script later.
0
 
LVL 48

Author Closing Comment

by:dbrunton
ID: 40596734
Sorry for delay.

Finally ran script after I worked out how to use Powershell.  Never used it before so this was all new.

Powershell does not like my Linux box.  The script errored out there with lots of complaints.  Does not like Linux filenames.

On the local drive it works OK.  There's work to be done there on some file names.
0
 

Expert Comment

by:XIPRELAY
ID: 40597151
which versions of powershell does that script work with ? sorry if that sounds like a stupid question.
0
 
LVL 48

Author Comment

by:dbrunton
ID: 40597250
I ran it on Windows 7 which is Powershell 3.0

I suspect it will probably run on 2.0 but don't know about 1.0
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question