Output file name on XP can not have a colon character

Posted on 2006-03-19
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

Question by:jerzyb
LVL 19

Expert Comment

by:Kim Ryan
ID: 16232615
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
LVL 19

Expert Comment

by:Kim Ryan
ID: 16232701
Perhaps NT is more tolerant of the colon but XP is stricter. Are you using the latest version of Samba?

Author Comment

ID: 16232994
pretty old, 2.0.4
will try something newer
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

LVL 85

Expert Comment

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

Author Comment

ID: 16237366
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 :-)

LVL 19

Accepted Solution

Kim Ryan earned 1500 total points
ID: 16244787
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.

Author Comment

ID: 16265023
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.
LVL 51

Expert Comment

ID: 16267716
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.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

593 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