Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 304
Default Using an Excel sheet for batch delete

Does this work if you have the file extention listed in the file name or
spaces in the name? I need to delete .aac & .wma files. Also, can you run
through sub folders? Meaning, I have 200 folders (albums) and I already have
the list, I need to delete the files within the folders.

Directory is: C:\Documents and Settings\My Documents\My Music
Sub Directory: C:\Documents and Settings\\My Documents\My Music\50 Cent
File name: 01 01 Track 1 Unknown Artist Unknown Album (4-24-2008 8-04-25
AM).wma

"Per Jessen" wrote:

Hi

Try this:

Sub test()
MyPath = "c:\temp\"
Set fs = CreateObject("Scripting.FileSystemObject")

LastRow = Range("A1").End(xlDown).Row

For r = 2 To LastRow
fs.DeleteFile MyPath & Cells(r, "A").Value
Cells(r, "A").ClearContents ' Remove file from list after deleting it
Next

End Sub

Best regards,
Per

"Colin Hayes" skrev i meddelelsen
...

HI All

I have an Excel worksheet with a list of file names in column A.

I'd like to use this list to look into a named directory (perhaps built in
to the routine , or entered via a popup) and delete files of the same name
in turn.

Once a file is deleted , then the routine would go back to Excel and look
up the next file name in the column for the next delete , and so on until
it reaches the end of the list.

Can someone help with this , please?

Grateful for any advice.



Best Wishes



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to automatically fill and submit (in batch) an online form fromdata in a excel sheet??? Christophe[_2_] Excel Discussion (Misc queries) 0 December 20th 07 07:57 AM
Delete "Unused names" in a batch D0306 Excel Discussion (Misc queries) 2 July 18th 07 04:40 PM
batch delete jason2444 Excel Discussion (Misc queries) 1 September 21st 06 04:01 AM
How to delete in batch the same color format letters in a cell yang xin Excel Worksheet Functions 1 February 5th 06 04:42 AM
How can we delete rows permanently from excel sheet Nehal Shah Excel Discussion (Misc queries) 1 August 1st 05 01:58 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"