File Object
Im trying to do something very simple with the file object. I try to access it but when I open the page through the browser my server doesnt seem to respond...it just wont load the page, much like what happens in an infinite loop, the status bar slowly moving up forever. I would be very grateful for ANY suggestions you may have to the problem. Ive attached my code below,
SET objFSO = Server.CreateObject("Scripting.FileSystemObject" )
SET objFile = objFSO.GetFile(Server.MapPath("log.txt" ))
Response.Write("log.txt was last modified " & objFile.DateLastModified)
SET objFile = NOTHING
SET objFSO = NOTHING ...
View Replies
ADVERTISEMENT
I have code that loops through a directory reading files..
now the problem is that files are constantly being uploaded and I only want the file system object to read those that are finished being uploaded.
How can I check the properties of the file to see if it's in middle of being written before i read the file?
View Replies
View Related
I am using the File System Object to create server side cookies and part of
the Function that I am writing deletes a file but I am getting a permissions
denied error on that line of code.
I am using Integrated security only on this site but how do I get the
IUSER_Machinename account to work with Integrated Security?
View Replies
View Related
I am trying to create a text file by using the following code. But it's not working. It just loading the page that's all.
<%
DIM fso, NewsFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set NewsFile = fso.CreateTextFile("c: est1.txt", True)
NewsFile.WriteLine("Hello World!")
NewsFile.Close
%>
View Replies
View Related
How the heck would I go about saving an object to file? Put would be perfect, and can basically save everything except objects - how do I save an object if I can't use put?
View Replies
View Related
I have a server which has 100 template websites on it, each with unique domains. This may grow upwards to 500 websites. As I have been publishing websites to the server now and then I come across a bug in some code OR wish to enhance an aspect of the site. With the exception of a file or two, every site on the server has the same folder hierarchy.
Example, every site has a directory called toolbox. If I make a change in one file located in a particular site, can I write a script that some how woud copy that file and iterate through ALL sites inserting that file as necessary. I don't expect someone to show me how to do this, but rather tell me if it is a logical approach to managing such a large number of sites.
View Replies
View Related
I am trying to create a text file by using the following code. But it's not working. It just loading the page that's all.
<%
DIM fso, NewsFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set NewsFile = fso.CreateTextFile("c: est1.txt", True)
NewsFile.WriteLine("Hello World!")
NewsFile.Close
%>
View Replies
View Related
Is there any command in FSO syntax to delete a record (delete a line) in a textfile database? Example:
WriteRecord.DeleteLine(Record)
View Replies
View Related
I have used File System object to write contents in a text file. But when i request the page, it just processing without completing the job.. The writing to text file is not happening.
View Replies
View Related
what im trying to do is write out certain files that our in a current folder. For example I have a folder called images and i have about 20 sub folders inside of the images folder. What i want to do is search the Images folder including all the subfolders and write the name and path of where ever the image was found inside of the images folder.
View Replies
View Related
I have about 200 documents to which I need to write a header and a footer. Appending (the footer) is easy, but I cannot figure out how to write to the very beginning of the file.
View Replies
View Related
when we use File system object in asp to read disk content of a server, in which sort order file system object reads and put all files in a list. well I put images in a folder and FSO reads and display on web page, I want to sort these images, for example by name or by date of creation.
How can I do that,If I have to do something with fso or, I can sepratly sort the listitem where fso stores the list.
View Replies
View Related
I have a web site that uses NT authentication. It accesses a file on another server using FSO. The user has full control of that file yet when trying to access it via the website they get a Access Denied error. Shouldn't IIS use the current security context (which has rights to file) to access the file?
View Replies
View Related
Given a folder with a hundred images can someone please show me how to loop through the files and rename them like this
auto1.jpg
auto2.jpg
auto3.jpg
etc
etc
View Replies
View Related
Can some tell me how can I search for a particular block of text within the file and delete it? Section of the file I want to change looks like the one below and I want all
the lines starting with dteHolidays[ deleted?
/* INSERT HOLIDAYS HERE!
*/
dteHolidays[0] = new Date("01/01/2004"); // CHRISTMAS DAY
dteHolidays[1] = new Date("04/09/2004"); // Good Friday
dteHolidays[2] = new Date("04/12/2004"); // Easter Monday
View Replies
View Related
I am building an upload script that overwrites any file with the same name, however the file could be a jpg, gif, bmp etc. Using 'fso.FileExists ' i can find if a file of the same name exists and remove it. The file will be saved as strMemberId.strFileExt. There is a possibility that file xyz.jpg may be re-uploaded as xyz.gif thus while the new image will be written to the folder the previous file will not be removed.
I am trying to find the best way of finding the file name of a file without the extension so I can delete any files that may exist with the same name but a have different extension. Is there a way of calling a wildcard in asp?
eg ' fso.FileExists(Server.MapPath("../tempfolder/" & strMemberId &".*" ))
' - tried this & several other combinations but it does not work.
The only other way I can see of doing it is to pass the file name into a string, strip the extension off it and then build an array to loop through the possible extensions but I am sure there is a better way.
View Replies
View Related
I have script which is to check if a folder is existed. Even though the folder (virtual directory) is existed but the script objFSO.FolderExists() always return false.
The script as following:
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("../images/thumb") Then
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
response.Write("Folder exists")
else
objFSO.CreateFolder(("../images/thumb")
response.Write("not existed")
end if
View Replies
View Related
whenever i am using the File System Object on IIS my ASP page tends to "hang", but doesn't report any errors.
View Replies
View Related
if it's possible to tell if a file is already open. If I have a file on the server that I just want to put log information to, and I don't want to have collisions obviously. Can I tell if the file is open already?
I would have the code loop until the file has been closed and then go ahead and do its thing. Alternatives are welcome. Databasing is an option, but I'd like to know anyway if the file can be "read" for open state.
View Replies
View Related
I have an include file - myUtilities.asp - containing 20-30 functions.
Would it waste less ressources if the functions were in an object instead?
There's about 20 pages including the file.
View Replies
View Related
I have recently built a web interface to handle files on my network at work. There has been another system in effect for quite some time, and we can't phase it out just yet. In this older system there is a lot of data pointing to files in a particular directory.
PHP Code:
// doesn't work. mypath=" heserversomedirectoryThat Has. a Decimal" // works mypath=" heserversomedirectoryThat doesnt have a Decimal" Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.Getfolder(mypath) Set fc = f.SubFolders
View Replies
View Related
I have an ASP Page that reads in the contents of a directory on the web server. My page hangs when it gets to 'MyFolder=set fso.GetFolder(FlrPath)'.
The FldrPath holds the correct path and fso has been set to
'Server.CreateObject("Scripting.FileSystemObject")'
what could be causing this?
View Replies
View Related
Does using the File system object multiple times across the page to check if relevant files exist use a lot of memory/server resource etc?
if this were the case, I was going to change this to check a DB field instead. ie when a file is uploaded then this is logged accordingle in the DB, then it can be this field used to check as to whether to display it or not - or are either equally.
View Replies
View Related
i am unable to create new folders using file system object. the createfolder method doesnt work....the progress bar becomes slow...and no folder is created....but the other methods such as folderexists work....i have also checked the permissions...all folders have read/write..
View Replies
View Related
Actually, I do not know why i can not add records to my access database table by using asp code, I get an error that tells me that the database file or object is read only file even though the file is not readable only from its proprties, I need some helpful information to solve this problem.
View Replies
View Related
Is there any way of rollback any changes made by the file system object in
the event of an error. I delete a file and copy one somewhere and the copy
fails is there anyway to rollback the delete. Essentially a file system
version of a transaction.
View Replies
View Related
I have created a function to remove file from the webserver, but it's not working of course...I am running IIS5.1 on WindowsXP. Here is a copy of my function Code:
View Replies
View Related
Im trying to parse data from a .mdb file to a com object [.dll] file. how to i get this.?
Then the .dll file perfoms the required calculations/conversion on the data parsed and displays the result to an ASP page.
View Replies
View Related
i am looking into using the File System object on an intranet through ASP so as the user can move files from there local drive onto the server drive.
i have got the code working moving files from one local drive to another but a problem arrises when i transfer from a local drive to a mapped network drive (the server).
the errror is: Permission Denied
the mapped network drive has full read and write access.
any ideas as to why this is happening, or is there a better way?
View Replies
View Related
I have a script that checks a database for records and saves each record set as an asp file. The script uses the "FileSystemObject" to do this and is run once a month, so I can create an archive. (I have been asked to do it this way for SEO reasons)
In my database there is a field for date, and this date is entered as dd/mm/yyyy. My question is if its possible to have the FileSystemObject create a folder for each month and save the asp files into it? Code:
View Replies
View Related
Here is my code:
fileSysObj.MoveFile (Server.MapPath(selectedFile), destination);
the variables selectedFile and destination are valid paths to valid directories.
I submit the form and the file has been moved to from the source directory but does not appear to get moved into the destination directory. Any workarounds are alternative methods are welcomed.
I have tried the Move method but this has the same result as MoveFile. Also the Copy and CopyFile methods have the same result also (the file remains in source obviously)
View Replies
View Related
I used to have some static htm files which used to display data. There is a
calling asp file which used to do something like below
if Request.QueryString("PageName").count = 0 then
strPageNameHtm = "toc.htm"
strPageNameInc = "toc.inc"
else
strPageNameHtm = Request.QueryString("PageName") & ".htm"
strPageNameInc = Request.QueryString("PageName") & ".inc"
end if
strPageNameHtm = server.mapPath(strPageNameHtm)
strPageNameInc = server.mapPath(strPageNameInc)
'response.write(strPageNameHtm)
set fs = server.createobject("scripting.fileSystemObject")
set f = fs.openTextFile(strPageNameHtm)
strSPDHtml = f.readall
The strSPDHTML info used to be displayed using a response.write(strSPDHTML).
This allowed the static content to be loaded up.
I switched the static pages to be asp pages having the content come from a
database. I would still like to maintain the controlling page logic. Can I
modify the above section of code in anyways to access the asp page content
View Replies
View Related
Need to query an access db usign the contents of a text file that has one entry in it, and id ie: drsmith
Here's what I have thus far (the db call is in an include file)
<%
Dim fso, read
set fso = createobject("scripting.filesystemobject")
set read = fso.opentextfile(server.mappath("settings.inc"))
SQL = "SELECT * FROM news WHERE Company_id = (??????)"
Set rs = Server.CreateObject("ADODB.RecordSet")
Set RS = Conn.Execute(SQL)
%>
View Replies
View Related