Software to delete ... umm.... files ??

Soldato
Joined
18 Oct 2002
Posts
10,078
Location
At home
Hi,

Got a scenario here where we have about 3500 directories. Each of those contain subdirectories and files.

Is there something which I can run which just deletes the files and subdirectories but leaves the original folders intact ?

Thanks
 
ok, there might be a better way of doing it.. but this is what i'd

go to the root dir -the one containing the 3600 folders (via cmd) and type

dir /b >c:\files.txt or make a bat file of that and run it from there

open the file in notepad and remove any file names from the file (so it'll just display the 3600 folder names)

now open excel, in B1, paste that list of names in, and in A1 fill down the text 'md'

so you'll have

md folder1
md folder2

etc

copy & paste A and B into notepad
then highlight the 'tab' (will appear to be a blank space) between md & the folder names, click copy

now do find & replace, and paste the 'tab' i've put one here.. " " for you into the findWhat field, and put a space in the replaceWith field, click replaceAll

now save this as folders.bat and place it in the root dir, delete all the original folders & files, then run the bat file and it'll re-create all the folders


hope this makes sense.. (all the folders will be re-made and have no files in them)
 
ah, seems you can't copy a 'tab' into forums properly, you know what i mean by that though yeah? because excel add's the tab in for the column divider
 
if its windows, try right click on the root of the folder, do a search for *.* then highlight and delete the files but not the folders?
 
trouble is they subdirectories contain more subdirectories

-actually you can do it like that, if you sort by In Folder, you'll be able to scan down and remove everything after the last folder with subfolders
 
Back
Top Bottom