Solved

Util to search for invalid file or folder names

Posted on 2014-10-21
8
197 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 28

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 47

Author Comment

by:dbrunton
ID: 40405256
Hmm.

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

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
 
LVL 28

Accepted Solution

by:
becraig earned 400 total points
ID: 40405379
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 47

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 47

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 47

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

Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

Join & Write a Comment

A list of useful business intelligence software.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Viewers will learn how to use the Hootsuite Dashboard.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now