Welcome Guest.   Make a donation to an author on the site August 02, 2014, 03:42:33 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2013! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: delete certain filetypes from fav folder  (Read 4459 times)
Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« 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
Logged
skwire
Moderator
*****
Posts: 4,022



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: January 03, 2012, 09:34:12 AM »

Just use a batch file like this:

Formatted for Text with the GeSHI Syntax Highlighter [copy or print]
  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
Logged

Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #2 on: January 03, 2012, 10:55:51 AM »

Wow, that was fast!  thumbs 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
Logged
skwire
Moderator
*****
Posts: 4,022



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« 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"
Logged

Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: January 03, 2012, 11:02:49 AM »

Yes!
Thank you!  thumbs up
Logged
Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« 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?

Logged
skwire
Moderator
*****
Posts: 4,022



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« 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?
Logged

rjbull
Charter Member
***
Posts: 2,738

View Profile Give some DonationCredits to this forum member
« 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.
Logged
Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« 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.


Logged
skwire
Moderator
*****
Posts: 4,022



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« 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?
Logged

Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #10 on: March 14, 2012, 06:25:37 PM »

-then the job is done at once :-)

?
Logged
skwire
Moderator
*****
Posts: 4,022



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« 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.
Logged

Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« 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. ?

Logged
rgdot
Supporting Member
**
Posts: 1,568


View Profile WWW Give some DonationCredits to this forum member
« 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
Logged
Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« 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
Logged
Ath
Supporting Member
**
Posts: 2,186



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« 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
Logged

Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« 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.
Logged
Curt
Supporting Member
**
Posts: 6,313

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #17 on: March 15, 2012, 11:56:45 AM »

post deleted.

temp' error.
Logged
rjbull
Charter Member
***
Posts: 2,738

View Profile Give some DonationCredits to this forum member
« 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:

[copy or print]
@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.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.04s | Server load: 0.06 ]