Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick Q => Filename.ext Processing

Status
Not open for further replies.

YoungManRiver

IS-IT--Management
Feb 9, 2004
220
0
0
US
All,

I was trying to create a list of files, over the week-end and write into MySQL. Same as DOS cmd "dir path\*.* /s /b > dir_list.txt", but into MySQL instead.

Kept getting an error on the "." from the filename.ext. I looked up the error and the MySQL manual says "." is a reserved word, not usable in database or table names, but says nothing about not being able to use as data in a field.

I know I've written full filenames into MySQL before using the "filename.ext" format, so figure it is something in the mysql.ini file.

To change this what am I looking for?

I know the obvious work around is to create another field for "ext" and then parse the file lines around the "." but prefer not to do this.

Thanks all for your help! It is much appreciated!

YMR
 
What exact command were you using? What is your table schema? There is no inherent reason to avoid a period in text or character data.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Sounds to me like maybe you just weren't quoting your file names. Perhaps you could post some code so we can get a better idea.
 
I'll have to agree with AdaHacker, keeping your values properly quoted should avoid any problems you may have with the period. And as he said, maybe posting your code can help us get a better idea of what is wrong.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
All,

I've tried all possible ways of quoting, manually adding, magicquotes, etc.

Even took the snapshot of query code to the SQL interactive on phpMyAdmin and tried it all there, but always get the same error, no matter what I try.

That's why I think it is a config issue.

YMR
 
All,

Oh hey, same code works on my office machine and writes the "filename.ext" but blows on the laptop, so it's not the code.

YMR
 
All,

Noticed the following:

The code also works differently in different browsers.

Ex1 MSIE:
File="C:\anypath\anyfile.html"
$HTTP_POST_VARS = "C:\anypath\anyfile.html"

Ex1 Mozilla:
File="C:\anypath\anyfile.html"
$HTTP_POST_VARS = "anyfile.html"
I tried the "realpath" command but when all the path info is missing the "realpath" command does not work right. Tried the following combinations:
$fil_res = realpath("C:\.\anyfile.html");
$fil_res = realpath("C:\..\anyfile.html");
$fil_res = realpath(".\anyfile.html");
$fil_res = realpath("..\anyfile.html");

$fil_res = realpath("C:/./anyfile.html");
$fil_res = realpath("C:/../anyfile.html");
$fil_res = realpath("./anyfile.html");
$fil_res = realpath("../anyfile.html");
None of these works in Mozilla.

So what is the work around to actually get the complete correct path and filename? I need this as the files got installed in different paths by the users on the computers, so need to actually find and validate the file.

YMR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top