Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 01, 2015, 09:14:43 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: delete certain filetypes from fav folder  (Read 5741 times)

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
DONE: delete certain filetypes from fav folder
« on: January 03, 2012, 09:27:04 AM »
For several years I have been following the Same Procedure As Last Year, James over and over each and every day: I download a bunch of music, I convert the music, I delete the redundant files type by type by type, and I move the converted music to a new directory. Lately my Vista has stopped indexing my .tunebite files, and this is making the deletion tedious. Suddenly I realized that at least this deletion procedure could be done much easier if a bat or ahk file was included.

So, my request / idea is for a file to automate the deletion of all .wma, .m3u and .tunebite files in a certain directory / favourite folder including all subfolders, with just a click. The file could very well be situated in the top folder in question.
 :tellme:

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,391
    • View Profile
    • Donate to Member
Re: IDEA: delete certain filetypes from fav folder
« Reply #1 on: January 03, 2012, 09:34:12 AM »
Just use a batch file like this:

Code: Text
  1. del /S /F c:\path\to\my\folder\*.wma
  2. del /S /F c:\path\to\my\folder\*.m3u
  3. del /S /F c:\path\to\my\folder\*.tunebite
  4.  

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: IDEA: delete certain filetypes from fav folder
« Reply #2 on: January 03, 2012, 10:55:51 AM »
Wow, that was fast!  :up:

---------
I don't know what is wrong, but it is not doing it.

Info:
The files are not in the top folder itself, but placed in a number of subfolders (album folders) that I cannot name in advance.

My .bat file does not include the numbering, 1, 2, 3, but begins with del
It has no "rare" characters in the path, and no end spaces, but a space is included in the fav folder name.

 :tellme:

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,391
    • View Profile
    • Donate to Member
Re: IDEA: delete certain filetypes from fav folder
« Reply #3 on: January 03, 2012, 10:59:04 AM »
If the path has spaces, be sure to double-quote them like this:

del /S /F "c:\path\to\my\folder\*.wma"
del /S /F "c:\path\to\my\folder\*.m3u"
del /S /F "c:\path\to\my\folder\*.tunebite"

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: IDEA: delete certain filetypes from fav folder
« Reply #4 on: January 03, 2012, 11:02:49 AM »
Yes!
Thank you!  :up:

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #5 on: March 14, 2012, 02:01:52 PM »
This was working so fine with my previous 32-bit Vista, but I cannot get it to work on my new 64-bit W7 - not even if I right-click it > Run as Adm'. Must anything be different?


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,391
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #6 on: March 14, 2012, 02:14:22 PM »
Seems to work fine here in a quick test on my wife's laptop (W7/64).  Are you positive the paths are the same?

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • gravatar avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #7 on: March 14, 2012, 04:53:46 PM »
As a minor tweak on skwire's batch file, you might like Horst Schaeffer's DelAge32:
Quote
DelAge32 deletes or moves files with a mimimum age given by the number of days.

Syntax:   DelAge32 filespec days [options]

The files are specified by search pattern (e.g. *.* for all files), with relative or absolute path.

Options include: /recurse (subdirectories), /subonly (excluding initial directory), /includeRO, /includeH, /includeS, /rd (remove empty subdirectories), /move target, /created (use "created" time stamp instead "last modified"), /accessed ..

Example:   DelAge32 "C:\some\where\*.*" 100 /recurse

Deleted files are listed with age (number of days). The output can be redirected to a file.
With option /preview the action can be safely tested without actually deleting or moving files.
I run batch files containing calls to DelAge32 routinely via my task scheduler, Kirby Alarm Pro.  That way I can keep files around for a while until I'm sure I'm not likely to need them again, and have them eventually automatically deleted by date without having to take manual action.

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #8 on: March 14, 2012, 05:22:46 PM »
Quote
del /S /F "C:\Users\Curt\Documents\PLAY\*.wma"
del /S /F "C:\Users\Curt\Documents\PLAY\*.m3u"
del /S /F "C:\Users\Curt\Documents\PLAY\*.tunebite"

I have tried both with and without "quotes". The path was copied from right-click > Copy path. I have also tried from both "Library/Docs..." and from ".../Users/Curt/Docs....", and from within "/Docs.../PLAY". Some of the folders to be handled have names with spaces, others without. And as I said, I have tried merely double-clicking, and right-clicking > Run as admin'. The text file is named skwire.bat

Need more info?  :tellme:


-------
Thank you, rjbulll. Can it delete files older than just a few minutes? Or can it delete per file extension type only? The process is: I download MWA music files, I convert them to MP3, I delete the downloaded files (wma and m3u), and obviously keep the converted ones, except the '.tunebite' that the converter created. The files to be deleted are placed in various subfolders, and seldom older than a few hours.



skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,391
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #9 on: March 14, 2012, 06:01:02 PM »
 :huh:  What happens if you bring up a command prompt and use one of those commands directly at the prompt?

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #10 on: March 14, 2012, 06:25:37 PM »
-then the job is done at once :-)

?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,391
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #11 on: March 14, 2012, 06:33:00 PM »
I really have no idea then.  I'm not all that well-versed in W7 so maybe somebody else can offer more.

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #12 on: March 14, 2012, 06:38:32 PM »
At first I was willing to bet it sees me as Curt The User instead of Curt The Administrator, but then I tried the Right-click > Run as admin' - so all my imagination can think of now is that maybe there is a difference between how a batch file must "be" for 32-bit versus 64-bit. ?


rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 1,798
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #13 on: March 14, 2012, 06:52:33 PM »
This may be way off but ...

You need to explicitly disable UAC eventhough you run as admin

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #14 on: March 15, 2012, 03:13:03 AM »
-yeah, more and more people are encouraging me to do just that. But my UAC is set at the next-highest level, (default), so if it was preventing this batch file from running, I really would expect UAC to pop up a box and ask or tell something, not to work 'hidden'.
 :tellme:

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,534
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #15 on: March 15, 2012, 06:27:27 AM »
What happens if you bring up a command prompt and use one of those commands directly at the prompt?
-then the job is done at once :-)
That depends on the type of Command prompt, a 'standard' one or an 'Administrator' command prompt, as the last one has better privileges and can execute nearly anything with admin rights :tellme:

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #16 on: March 15, 2012, 11:26:30 AM »
-I used a command prompt without noted administrator privileges.

----------------

Taking ownership of the folders in question, did not change anything.

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • gravatar avatar
  • Posts: 6,755
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #17 on: March 15, 2012, 11:56:45 AM »
post deleted.

temp' error.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • gravatar avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: DONE: delete certain filetypes from fav folder
« Reply #18 on: March 15, 2012, 04:48:29 PM »
Thank you, rjbull. Can it delete files older than just a few minutes? Or can it delete per file extension type only?
Yes to both; "age" is age in days, not minutes.
Quote
DelAge32 - ver. 2.3 (c) 2003-2008, Horst Schaeffer
Deletes or moves files (path with file pattern) by age (number of days)
Syntax:  DelAge32 filespec age [options]
Options:
  /created /accessed /modified (default) - file stamp used to evaluate age
  /includeRO - include read-only files
  /includeH  - include hidden files
  /includeS  - include system files
  /includeRHS -include read-only, hidden and system files
  /recurse   - include subdirectories
  /subonly   - /recurse excluding initial directory
  /rd        - remove empty subdirectories
  /move path - move files to specified path
  /preview   - list, but no action
  /quiet     - no output

The process is: I download MWA music files, I convert them to MP3, I delete the downloaded files (wma and m3u), and obviously keep the converted ones, except the '.tunebite' that the converter created. The files to be deleted are placed in various subfolders, and seldom older than a few hours.
I do something similar.  I prefer to edit most of my forum posts in my text editor, and I use Text Editor Anywhere (TEA) as an aid in transferring text between forum and editor.  TEA saves its files.  I regularly archive them, but don't move them into the archive as I like to leave the most recent ones readily available.  The same batch file runs delage to delete all the ones that are 32 days or more old, by which time I wouldn't expect to need quick reference to them.  My current cleanup.bat, which does other things as well, looks something like this:

Code: [Select]
@echo off
:: archive all Text Editor Anywhere text files (not just forum posts, all Web forms)
"c:\Program Files\WinRAR\Rar.exe" u -ep -log="c:\Users\rjbull\backup\ForumPostBackups.log" "c:\Users\rjbull\backup\ForumPostBackups.rar" "c:\NoInst\Text Editor Anywhere\Temp\*.txt"
:: Clean up
c:\DOS\Utils\delage32.exe "c:\NoInst\Text Editor Anywhere\Temp\TextEditorAnywhere*.txt" 32 /quiet
c:\DOS\Utils\delage32.exe "c:\NoInst\Text Editor Anywhere\Temp\TextEditorAnywhere*.bak" 10 /quiet
c:\DOS\Utils\delage32.exe "c:\Users\rjbull\Documents\HippoEdit_backups\*.*" 32 /recurse /quiet
cls
exit
Note that I've set different deletion ages for *.txt and *.bak files.