14179 Delete multiple files from a folder using an Access Database
Sign Up |  Live StatsLive Stats    Articles 37,464| Comments 178,573| Members 19,492, Newest sikh15| Online 489
Home Contact
 (Forgotten?): 
    10 years of Excellence
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags
Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » Delete multiple files from a folder using an Access Database

Delete multiple files from a folder using an Access Database

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 0 USD (0%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Lost Access database files? Lindy Information Technology 0 28-Jul-2006 08:42 AM
Access 2007 - delete database Don Information Technology 4 28-Jul-2006 08:38 AM
Multiple Delete of queries or tables in Access Lizzie Information Technology 0 28-Jul-2006 08:37 AM
Re: Create Directory / Copy Files / Delete Files Zadok @ Port of Seattle Information Technology 1 28-Jul-2006 08:19 AM
Access 2007 Beta 2, Cannot delete a database relationship! Bg Information Technology 0 28-Jul-2006 08:17 AM


Tags
delete, multiple, files, folder, using, access, database
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:27 AM
dlow123@gmail.com's Avatar dlow123@gmail.com
Guest
 
Posts: n/a
   
   
Delete multiple files from a folder using an Access Database

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Good Morning All,

I am not sure if I am posting this in the right place, but please bear
with me.

I am trying to run a db query to quickly populate a database with
filenames from a folder on my hard drive. Then in turn I would like to
be able to delete files from the folder, based on my deletes in the
database.

I hope that this makes sense. I am currently using the following code
in the Visual Basic editor to populate my table with the necessary
data:

Sub GetGameFiles()
Dim strFile As String
Dim strFolder As String
Dim strSQL As String

strFolder = "C:\path\to\thefile\iwantadded\tothisdb\"
strFile = Dir(strFolder & "*.*")
Do While Len(strFile) > 0
strSQL = "INSERT INTO gamenames (gamefilename) " & _
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/12226-delete-multiple-files-folder-using-access.html
"VALUES (" & Chr$(34) & strFile & Chr$(34) & ")"
CurrentDb.Execute strSQL, dbFailOnError
strFile = Dir()
Loop

End Sub

I am currently running Access 2003. I also thought about trying this
with Excel 2003

If anyone can offer assistance it would be greatly appreciated.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12226

Thank you.

Devon L.



Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:27 AM
Michael H's Avatar Michael H
Guest
 
Posts: n/a
   
   
RE: Delete multiple files from a folder using an Access Database

  Donate Today!  
Hi.

Is there any other reason you are placing the filenames into a table first?
Why not just delete the files within the Do While loop?

Just replace this:
strSQL = "INSERT INTO gamenames (gamefilename) " & _
"VALUES (" & Chr$(34) & strFile & Chr$(34) & ")"
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12226
CurrentDb.Execute strSQL, dbFailOnError

With this:
Kill strFolder & strFile

Or, if you need the filenames in a table for some additional reason, just
insert my line of code right before this one:
strFile = Dir()

-Michael



"dlow123@gmail.com" wrote:

> Good Morning All,
>
> I am not sure if I am posting this in the right place, but please bear
> with me.
>
> I am trying to run a db query to quickly populate a database with
> filenames from a folder on my hard drive. Then in turn I would like to
> be able to delete files from the folder, based on my deletes in the
> database.
>
> I hope that this makes sense. I am currently using the following code
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12226
> in the Visual Basic editor to populate my table with the necessary
> data:
>
> Sub GetGameFiles()
> Dim strFile As String
> Dim strFolder As String
> Dim strSQL As String
>
> strFolder = "C:\path\to\thefile\iwantadded\tothisdb\"
> strFile = Dir(strFolder & "*.*")
> Do While Len(strFile) > 0
> strSQL = "INSERT INTO gamenames (gamefilename) " & _
> "VALUES (" & Chr$(34) & strFile & Chr$(34) & ")"
> CurrentDb.Execute strSQL, dbFailOnError
> strFile = Dir()
> Loop
>
> End Sub
>
> I am currently running Access 2003. I also thought about trying this
> with Excel 2003
>
> If anyone can offer assistance it would be greatly appreciated.
>
> Thank you.
>
> Devon L.
>
>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
English Sri Guru Granth Sahib Ji and SRM
Today 12:27 PM
2 Replies, 17 Views
Edward Snowden: the...
Today 11:30 AM
2 Replies, 59 Views
What Is Difference...
Today 09:18 AM
6 Replies, 150 Views
First There is Water by...
By Ishna
Today 05:03 AM
3 Replies, 182 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 03:11 AM
403 Replies, 9,340 Views
Difference in Bowing...
Today 02:18 AM
8 Replies, 164 Views
Cooking Without Alcohol
Today 02:12 AM
12 Replies, 165 Views
Learning from Baba...
Today 01:38 AM
0 Replies, 302 Views
Eckhart Tolle
Yesterday 18:08 PM
2 Replies, 110 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Yesterday 17:21 PM
252 Replies, 5,966 Views
Thought of the Moment!
Yesterday 16:35 PM
115 Replies, 6,050 Views
New Quantum Dot...
Yesterday 09:38 AM
0 Replies, 56 Views
Girl, 5, Collects...
Yesterday 06:48 AM
0 Replies, 82 Views
No Secrets! Metadata...
Yesterday 06:01 AM
2 Replies, 71 Views
My Dad's a Dude! ......
By Aisha
16-Jun-2013 22:08 PM
4 Replies, 280 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 13:04 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.35000 seconds with 32 queries
0