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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filename with "&" cannot be uploaded into SPS2003?

Status
Not open for further replies.

zacca

Technical User
Dec 25, 2003
333
HK
Hi there,

Just built SPS2003 server & now mass upload files into it.
Found that if the filename contains some special characters like "&" or "~" then the file cannot be uploaded, & it will stop the mass file upload process as well.

As I really got very very lot of files got "~" or "&" inside the filename, now I need to fix them 1 by 1, which is killing me.

Wondering if any trick I can mass change the "&" to "and" in the filename for all related files?

Or, if any settings in SPS2003 can allow filename with "&" or "~"?

Million thanks in advance!

 
You could write a bit of VBS to go through all your files renaming them before doing the upload. It's the only thing I can think of at the moment.

Something like this should do the trick:

set fso = createobject ("scripting.filesystemobject")

Sub RecursiveFolderCheck (FolderRoot)
Set ThisFolder = fso.getfolder (folderroot)

for each folder in thisfolder.subfolders
recursivefoldercheck folderroot & "\" & folder.name
next

for each file in thisfolder.files
if instr (originalName, "&") then
fso.copyfile FolderRoot & "\" & file.Name, FolderRoot & "\" & replace (file.Name, "&", "and")
fso.deletefile FolderRoot & "\" & file.Name
end if
next

set thisfolder = nothing
end sub

recursivefoldercheck "\\servername\sharename"
set fso = nothing

msgbox "done"
 
Hi mhiney,

Thx so much for your help, as i'm not good in vb scrpit, i just simply copy your codes & run it.

I got the "done" box but the filename with "&" still not yet changed......

Wondering what's wrong? Many thanks!
 
In the 3rd last line, did you change "\\servername\sharename" to the root folder of the stuff you want to upload? (Actually, you must have, or you would have gotten errors all along the way...)

Bear with me for a bit - I'll create a dummy directory and do a few test runs to see if I can replicate the prob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top