Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Deleting mass files ending in specific characters

05 Mar 2015   #21
ignatzatsonic

Microsoft Community Contributor Award Recipient

Windows 7 Home Premium SP1, 64-bit
 
 

OK.

You've got about 30 songs listed. Of those, only one is OK as of now--the one that begins with 2am.

I assume the OK files not in any particular subdirectory that could be excluded from your renaming and that they are scattered across all directories?

I'd think you are going to have to separate the "OK" titles manually if you intend to use a file renamer program. This is because you DON'T have a consistently wrong pattern. In most cases, you want to shave the left side, but in some cases you don't.

If you can separate the OK files, then you can shave a single character from the left edge. A file incorrectly named 1jones.mp3 would then be jones.mp3 and would be OK. You'd then have to move jones.mp3 elsewhere.

Then shave another character off in a second pass. Now a file that began as 43Jones.mp3 becomes OK. Move it.

Continue shaving a character at a time.

If 95% of your files can be done this way, maybe you take the time to manually separate the other 5% (those like 2AM) so they wouldn't be affected. Or re-obtain them.

Some of those files are mp3. If the tags are good, you could use mp3Tag to force the file name to match the tag.

So, a file named 22jones.mp3 that had an artist tag of Dean Martin and a title tag of In The Misty Moonlight could be renamed to Dean Martin - In The Misty Moonlight.

I don't know if other file types such as m4a could be similarly renamed from tags or if they even have tags.

Someone who is really slick with programming may be able to whip up a custom script or something, but you are handicapped by the fact that SOME of your files are OK now. You don't want the script or a re-naming program to act on them.


My System SpecsSystem Spec
.
05 Mar 2015   #22
COSenna

Windows 7 x64
 
 

Gotcha, thats kinda what I figured.

Thanks for taking the time ignatzatsonic! I sincerely appreciate it!

COSenna
My System SpecsSystem Spec
06 Mar 2015   #23
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi,

COSenna, did you end up fixing your initial problem of the @# suffix in filenames? I've attached a batch file that will help with that.

Preview:
Code:
@echo off
setlocal EnableDelayedExpansion

REM Delete all files with a filename ending with "@1", "@2" ... "@9".
REM And lob off "@0" from the end of a filename should it exist.

set file_masks="*.mp3" "*.m4a"
set should_recurse=TRUE
set should_overwrite_duplicates=FALSE
set WhatIf=FALSE

pushd "%~dp0"
if /i %SHOULD_RECURSE%==TRUE set recurse_switch=/s
if /i %WHATIF%==TRUE set echo=echo
for /f "delims=" %%I in (' dir /b %FILE_MASKS% %RECURSE_SWITCH% ') do (
	echo."%%~fI"| findstr "@[1-9]\..*$" >NUL && %ECHO% del "%%~fI"
	echo."%%~fI"| findstr "@0\..*$" >NUL && (
		set file_name=%%~nI& set file_ext=%%~xI
		set new_file_name=!FILE_NAME:~0,-2!
		if not exist "%%~dpI\!NEW_FILE_NAME!!FILE_EXT!" (
			%ECHO% ren "%%~fI" "!NEW_FILE_NAME!!FILE_EXT!"
		) else (
			if /i %SHOULD_OVERWRITE_DUPLICATES%==TRUE (
				%ECHO% del "%%~dpI\!NEW_FILE_NAME!!FILE_EXT!" /q
				%ECHO% ren "%%~fI" "!NEW_FILE_NAME!!FILE_EXT!"
			)
		)
	)
)
popd


Attached Files
File Type: bat th-362951.bat (960 Bytes, 0 views)
My System SpecsSystem Spec
.

08 Mar 2015   #24
cjkuhlenbeck

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Pyprohly View Post
Hi,

COSenna, did you end up fixing your initial problem of the @# suffix in filenames? I've attached a batch file that will help with that.

Preview:
Code:
@echo off
setlocal EnableDelayedExpansion

REM Delete all files with a filename ending with "@1", "@2" ... "@9".
REM And lob off "@0" from the end of a filename should it exist.

set file_masks="*.mp3" "*.m4a"
set should_recurse=TRUE
set should_overwrite_duplicates=FALSE
set WhatIf=FALSE

pushd "%~dp0"
if /i %SHOULD_RECURSE%==TRUE set recurse_switch=/s
if /i %WHATIF%==TRUE set echo=echo
for /f "delims=" %%I in (' dir /b %FILE_MASKS% %RECURSE_SWITCH% ') do (
	echo."%%~fI"| findstr "@[1-9]\..*$" >NUL && %ECHO% del "%%~fI"
	echo."%%~fI"| findstr "@0\..*$" >NUL && (
		set file_name=%%~nI& set file_ext=%%~xI
		set new_file_name=!FILE_NAME:~0,-2!
		if not exist "%%~dpI\!NEW_FILE_NAME!!FILE_EXT!" (
			%ECHO% ren "%%~fI" "!NEW_FILE_NAME!!FILE_EXT!"
		) else (
			if /i %SHOULD_OVERWRITE_DUPLICATES%==TRUE (
				%ECHO% del "%%~dpI\!NEW_FILE_NAME!!FILE_EXT!" /q
				%ECHO% ren "%%~fI" "!NEW_FILE_NAME!!FILE_EXT!"
			)
		)
	)
)
popd
Already tried. Some people just prefer third party apps. :/

However, I noticed you're using iTunes for your library. Since iTunes uses its own index, removing the files will not remove them from iTunes.

DO NOT REGENERATE THE LIBRARY. Most of the time, these duplicates are caused by iTunes preferences, which most are setup to cause this chaos by default. Regenerating the library from scratch could actually wind up causing more duplicates, and may not snag all the files. Instead, just create a smart playlist to remove them.

Here's a pretty helpful guide on how to - Find and Sort the Missing "Exclamation Point" Tracks in iTunes

You can also do this i'm sure with third party apps, but even the third party app supporters would likely agree this is easier.

Best of luck, and hope you solved the issue.
My System SpecsSystem Spec
Reply

 Deleting mass files ending in specific characters




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Deleting corrupt files corrupts more files?
Laptop: Acer Aspire 5552 OS: Windows 7 Home Premium AV: Avast! Antivirus Pro I have an 2TB external hard drive (Toshiba) where I keep my music, movies, etc. About two months ago, I had an issue where the drive became inaccessible due to the data cable disconnecting during file transfers. The...
Hardware & Devices
Deleting files
I am trying to delete an old copy of windows from a second drive, i am set up as the administrator in win 7 ult drive C... but i can't delete the copy of widows from drive E. I get an error message saying i need permission from the trustedinstaller to make changes to this folder. I am using drive E...
Performance & Maintenance
DOS Batch - Forfiles - deleting specific file extensions
Hey all. I've reviewed several different examples of how forfiles works. To set the stage, I need to automatically remove files with a file extension of .0 followed by numbers that increment and these files would be 7 days or older. Unfortunately, none of the examples or forfiles /? usage...
Customization
Utility for mass permissions/proprietary change of files.
Hello, Is there such an utility? Thanks.
Software
FAT32 Flash drive can store files with more than 8.3 characters?
For some reason, FAT32 flash drive can store files with more than 8.3 characters? I thought FAT formatted drives can only have files with names that are no longer than 8.3 characters?
Hardware & Devices
Foreign Characters/Characters appearing.
Hi there. This is an odd problem, whenever certain characters are used ("^ are just some) then a letter is pressed foreign characters appear. I.E When I press " Then O it comes up as , instead of "O, and so on. Does anyone have any ideas, on how this could be fixed. I've checked in the...
Hardware & Devices


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:57.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App