Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2003, 01:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default spaces problem

Spaces could be removing from the image files which is save in d:\drive by command etc..
Any script or query helps it?

Imagename like this.
-----------------------------
al town road.tif
al plan road.tif
al city town stage.tif
al city plan stage I-031.tif
al gulf state I-082.tif

and so on……..
I have thousand of records, it is very difficult to rename the files one by one.
Is is not display the image due to spaces.
I remove the space from the sql database but how can
remove space from drive ? files are save in d:\drive.

Please help

Mateen
 
Old July 30th, 2003, 01:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Copy the stuff below into a text editor and save with a .vbs extension. Change the Const FOLDER_PATH to the path for the directory.

Code:
Option Explicit

Const FOLDER_PATH = "C:\SomePath"

Dim FSO, FldrObj, FileObj
Dim strName

Set FSO = CreateObject("Scripting.FileSystemObject")

Set FldrObj = FSO.GetFolder(FOLDER_PATH)

For Each FileObj In FldrObj.Files
    FileObj.Name = Replace(FileObj.Name, " ", "")
Next

Set FldrObj = Nothing

Set FSO = Nothing
regards
David Cameron
 
Old July 30th, 2003, 11:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for response.

stuff (images files) are save d:/cather/nontripimages2/images.vbs folder by text editor.
And script file also save same folder d:/cather/nontripimages2/script.vbs
I run the script.vbs at the explorer it give following error message

Microsoft VBScript runtime (0x800A004C)
Path not found
/dcil/nontripimages2/script.asp, line 11


Option Explicit

Const FOLDER_PATH = "d:/cather/nontripimages2/images.vbs"

Dim FSO, FldrObj, FileObj
Dim strName

Set FSO = CreateObject("Scripting.FileSystemObject")

Set FldrObj = FSO.GetFolder(FOLDER_PATH)

For Each FileObj In FldrObj.Files
    FileObj.Name = Replace(FileObj.Name, " ", "")
Next

Set FldrObj = Nothing

Set FSO = Nothing


where script will use ? in separate file or in images.vbs files ?




Quote:
quote:Originally posted by David Cameron
 Copy the stuff below into a text editor and save with a .vbs extension. Change the Const FOLDER_PATH to the path for the directory.

Code:
Option Explicit

Const FOLDER_PATH = "C:\SomePath"

Dim FSO, FldrObj, FileObj
Dim strName

Set FSO = CreateObject("Scripting.FileSystemObject")

Set FldrObj = FSO.GetFolder(FOLDER_PATH)

For Each FileObj In FldrObj.Files
    FileObj.Name = Replace(FileObj.Name, " ", "")
Next

Set FldrObj = Nothing

Set FSO = Nothing
regards
David Cameron
 
Old July 31st, 2003, 01:28 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1. I very carefully named the constant "FOLDER_PATH". I also said in the post the website that you needed to "Change the Const FOLDER_PATH to the path for the directory.". Could I have made it any clearer? You have specified a path to a *file* not to a *directory*.
2. When using windows it is preferred to use \ as the seperator for folders. / is used for web stuff, \ for files. Get used to it. Using / could cause problems.

Code:
Option Explicit

Const FOLDER_PATH = "d:\cather\nontripimages2"

Dim FSO, FldrObj, FileObj
Dim strName

Set FSO = CreateObject("Scripting.FileSystemObject")

Set FldrObj = FSO.GetFolder(FOLDER_PATH)

For Each FileObj In FldrObj.Files
    FileObj.Name = Replace(FileObj.Name, " ", "")
Next

Set FldrObj = Nothing

Set FSO = Nothing
regards
David Cameron
 
Old August 3rd, 2003, 03:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response.
You explain the problem very clearly but it is my weak point that I doing mistake it

Image files are save c:\folder_path\images.vbs (all images name
                             are save by wordpad)
Script file save c:\folder_path\script.vbs

folder_path is use alias of localhost

when I run http://localhost/folder_path/script.vbs it gives message that save it , when as script.vbs file already save
in c:\folder_path

script.vbs file coding is
-----------------------------------------------------------------
Option Explicit

Const FOLDER_PATH = "C:\FOLDER_PATH"

Dim FSO, FldrObj, FileObj
Dim strName

Set FSO = CreateObject("Scripting.FileSystemObject")

Set FldrObj = FSO.GetFolder(FOLDER_PATH)

For Each FileObj In FldrObj.Files
    FileObj.Name = Replace(FileObj.Name, " ", "")
Next

Set FldrObj = Nothing

Set FSO = Nothing
------------------------------------------------------------------

it will be very helpful for me if you do amendment in the above coding or path which is I wrongly used.
I am very sorry for inconvenience causes to you.

Thanks for your cooperation and help.

Regard.


Quote:
quote:Originally posted by David Cameron
 1. I very carefully named the constant "FOLDER_PATH". I also said in the post the website that you needed to "Change the Const FOLDER_PATH to the path for the directory.". Could I have made it any clearer? You have specified a path to a *file* not to a *directory*.
2. When using windows it is preferred to use \ as the seperator for folders. / is used for web stuff, \ for files. Get used to it. Using / could cause problems.

Code:
Option Explicit

Const FOLDER_PATH = "d:\cather\nontripimages2"

Dim FSO, FldrObj, FileObj
Dim strName

Set FSO = CreateObject("Scripting.FileSystemObject")

Set FldrObj = FSO.GetFolder(FOLDER_PATH)

For Each FileObj In FldrObj.Files
    FileObj.Name = Replace(FileObj.Name, " ", "")
Next

Set FldrObj = Nothing

Set FSO = Nothing
regards
David Cameron
 
Old August 3rd, 2003, 06:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Go to the machine where the file is saved. Log into the machine. Open up windows explorer. Browse to where the file is stored. Double click on the file.

regards
David Cameron
 
Old August 6th, 2003, 11:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for response.

when open windows explorer and double click on the file it give
error message

c:\FOLDER_PATH\script.vb
line 15
char 5
file aready exits
code 800A003A
Microsoft VBScript runtime error.


Regards.



Quote:
quote:Originally posted by David Cameron
 Go to the machine where the file is saved. Log into the machine. Open up windows explorer. Browse to where the file is stored. Double click on the file.

regards
David Cameron
 
Old August 8th, 2003, 11:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

please help


Quote:
quote:Originally posted by mateenmohd
 thanks for response.

when open windows explorer and double click on the file it give
error message

c:\FOLDER_PATH\script.vb
line 15
char 5
file aready exits
code 800A003A
Microsoft VBScript runtime error.


Regards.



Quote:
quote:Originally posted by David Cameron
 Go to the machine where the file is saved. Log into the machine. Open up windows explorer. Browse to where the file is stored. Double click on the file.

regards
David Cameron
 
Old August 11th, 2003, 06:27 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are trying to alter the name of a file to that of an existing file.

regards
2 days
David Cameron





Similar Threads
Thread Thread Starter Forum Replies Last Post
Spaces XP Programmer911 General .NET 1 December 19th, 2007 07:03 AM
Diference between these two name spaces pradeepn XSLT 1 June 25th, 2007 02:31 AM
disappearing spaces gezi XSLT 0 March 26th, 2006 02:23 AM
Removing spaces Dave Brown Beginning PHP 2 October 28th, 2005 12:02 PM
Frame Spaces EvilGuyWhoEatsBrains HTML Code Clinic 2 January 5th, 2005 12:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.