Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Util to search for invalid file or folder names

Posted on 2014-10-21
8
Medium Priority
?
231 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 55

Assisted Solution

by:Joe Winograd, EE MVE 2015&2016
Joe Winograd, EE MVE 2015&2016 earned 400 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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 29

Accepted Solution

by:
becraig earned 1600 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

670 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