I want to delete *.mp3 files that appear more then ones on my HD.
I built Program that scans my HD and puts the songs name and it's path to Access Database.
Now i need a query that will give me pathes of files to
delete(=files that have the same name) .
the Table (Files) looks like this : file attached
pls help me...
You can use the Query Wizard - Finding Duplicated Values which will walk you through which field(s) "ie. Name" you want to use to find duplicated values on. This will give you a query of all the records which were duplicated on name and you can then go through it and delete the duplicated ones you don't want. Make sure you also return the other fields (in one of the steps) so you know which ones you want to delete and which ones you want to keep.
I dont want to do it manualy, I have lots of duplicated files ,
So my final goal is to creat script (bat file) that will delete them automaticly .
So if anyone got idea for SQL Query please write it to me ....
1. Do the Find Dups query as suggested (Let's say it's called DupFind).
2. Make another Find Dups query but then change it to a make table query and make a table called: TempDupTable.
3. In your first Find Dups query (DupFind), delete all the duplicated records.
4. Using the TempDupTable you created, make a query setting the properties of the query (Unique Values to Yes.)
5. Make this an append query and append the records back to your main table (You won't be able to bring in the fields Size and FullPath though).
Since you have different Size and FullPath values, you'll need to go through these records and fill in/check the locations so this may take you some time anyway. There's no easy way to do it with queries unless you want to write some code and walk through the records one by one. I'd write you some code on how to do it but I'm limited on time - sorry. You'd still be stuck on which record to keep and which ones to delete though even if you did it through code (because you have different values for Size and FullPath unless you don't care about these values.)
If you don't / won't delete the files manually then you will have to resort to some processing yourself. , seems odd thought to use Access VBA to identify the duplicate files and then use a god old DOS batch file to do the dirty deed.
I'd be minded to follow PKStormys suggestions, create a duplicates query using the Access wizard. Then use that query as the feed to a VBA process in a new form (or possibly save the results as a table) so you can do your edit to select which record (sorry MP3) to delete). Then delete the file under code, by skipping the first record found and deleting any others. It may not be the fastest, or the most elegant but it will do what you want.