ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 2nd, 2003, 10:24 AM
Digitalosophy Digitalosophy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 74 Digitalosophy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 25 m 20 sec
Reputation Power: 6
Deleting Files From Server

Hi all,

How can I call all files in a folder on a server and then give a user the option to delete them?

-Thanks in advance

Reply With Quote
  #2  
Old September 2nd, 2003, 10:31 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Trivial...

First, you read on FSO(File System Object)
Then when you're ready, you start coding!

Seriously...your question is too large, are you expecting me, or anyone for that matter to give you the entire code???

Anyway...

1) Create the object like this:
Set objFSO = CreateObject("Scripting.FileSystemObject")

2) Then read the folder you want and display it inside a nicely formatted html <table>...</table>

3) Add a delete <button> in each <tr>...</tr> of your <table>...</table>

4) Add an onclick attribute to that button calling a javascript function which is created inside the <head>...</head> portion of your code.

5) The function should submit the page to another page where you then declare another objFSO object

6) As the function submits to the other page, it passes a parameter, the actual file name the user wanted to delete.

7) You then delete the file in question using FSO


You must read on FSO in order to understand this...

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old September 2nd, 2003, 10:38 AM
Digitalosophy Digitalosophy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 74 Digitalosophy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 25 m 20 sec
Reputation Power: 6
Quote:
Originally posted by Vlince

Seriously...your question is too large, are you expecting me, or anyone for that matter to give you the entire code???


Nope I never ask for code

Your explanation helped, I know it's not easy

Thanks

Reply With Quote
  #4  
Old September 2nd, 2003, 10:44 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Yes... I shouldn't assume that you wanted code you are right!

what can I say...people usually ask for code without trying first

My bad Digitalosophy

Hope the information I gave you will help you in your quest!

Sincerely

Vlince

Reply With Quote
  #5  
Old September 2nd, 2003, 10:50 AM
Digitalosophy Digitalosophy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 74 Digitalosophy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 25 m 20 sec
Reputation Power: 6
Well boy you weren't kidding when you said "Trivial". I am reading about the File Sytem Object right now. Wow very powerful but also very complicated. Let me ask you this:

Here is what I have to do:

I create an admin console for our local intranet. it controls the whole site, including file upload and all that good stuff. Now the problem is this:

The admin has option to delete entries in DB which point to pdf files. Now obviously when he deletes the record the file still remains on the server. Should I just give him access to that folder so he can delete old PDF files instead of getting into all this?
[edit] oh and thanks i really appreciate your time and advise [/edit]

Reply With Quote
  #6  
Old September 2nd, 2003, 11:15 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Well you first create your SQL query that DELETEs the entry in your database, then you execute the Query.

Then, still inside the *same* asp page, you create the objFSO object and delete the file name associated to the entry you've deleted.


A good way is to get the file's path first!
Then DELETE in the database!
Then delete on the physical drive using the file's path you've retrieved!


Hope this helps!
Sincerely

Vlince

Reply With Quote
  #7  
Old September 2nd, 2003, 11:29 AM
Digitalosophy Digitalosophy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 74 Digitalosophy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 25 m 20 sec
Reputation Power: 6
hmm
Code:
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

objFSO.DeleteFile "C:\InetPub\wwwroot\iop\file.asp", False

Set objFSO = Nothing


I guess all I have to do now is make file.asp the actual file name, which shouldn't be hard because I already have a record set which calls it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Deleting Files From Server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT