We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Output file name on XP can not have a colon character

jerzyb asked
Medium Priority
Last Modified: 2012-08-14
My Perl script on NT happily creates a file (over Samba on a Unix file server) with a name like "sql.031906.22:34.1" . However, refuses to do it on Active Perl XP when ':' is in the name. why?

thanks, jerzyb

Watch Question

Kim RyanIT Consultant

Microsoft filesystems, such as NTFS, do not support the use of certain characters in filenames. Characters such as colon (:), asterisk (*), question mark (?) and vertical bar (|) are not allowed. The colon character is reserved for a drive specifier, such as C:\file.txt
Kim RyanIT Consultant

Perhaps NT is more tolerant of the colon but XP is stricter. Are you using the latest version of Samba?


pretty old, 2.0.4
will try something newer
Most Valuable Expert 2014
Top Expert 2015

Can you create at filename with ':' in the name using anything other than perl?


its not samba: I built a new Perl script on XP and traced the SMB protocol: when I run it with a file name with a colon (:), it does not even go to Samba; as soon as I change colon into a period (.), it works. Also, I can not create file names with a colon outside Perl for both NT and XP. So, both NT and XP are equally dum, but somehow NT Perl took care of that.

I guess Active Perl for XP is the problem.

Is there a way to bypass, escape it or something? I want colons in my file names :-)

IT Consultant
It's not iseal but as a work around you could use perl to name the files something like sql.031906.22_colon_34.1"
Then run a small script on Unix file server to repalce _colon_ with :

Have you tried asking this question on a samba newgroup or mailing list?

Or could you run your main script directly on the unix server?

Not sure why you need colons, it just seems to be a seperator between hours and minutes. Your app is more poratable if you can avoid these characters in file names.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Come on, teraplane. I think I proved that its NOT samba: the XP is not even trying to go out on the wire. As for running on the server, I would gladly run it on Unix if I could but the whole company is going Microsoft (still remember everyone blindly following IBM as recently as 20 years ago). ActivePerl people might know but their official line is not to use colon.

Have no choice, bite the bullet and modify all programs that read those files.

Thanks anyway.
it's not perl but the used native M$ dll for I/O.
Try to find a perl.exe linked against another dll, AFAIK plain old perl-4 executable from DOS does not rely on this restriction.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.