Solved

Util to search for invalid file or folder names

Posted on 2014-10-21
8
211 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
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

828 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