Solved

Util to search for invalid file or folder names

Posted on 2014-10-21
8
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 49

Author Comment

by:dbrunton
ID: 40405256
Hmm.

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

Assisted Solution

by:Joe Winograd, EE MVE 2015&2016
Joe Winograd, EE MVE 2015&2016 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 29

Accepted Solution

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

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 49

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 49

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

631 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