Deleting mass files ending in specific characters

Page 3 of 3 FirstFirst 123

  1. Posts : 12,012
    Windows 7 Home Premium SP1, 64-bit
       #21

    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.
    Last edited by ignatzatsonic; 05 Mar 2015 at 23:00.
      My Computer


  2. Posts : 12
    Windows 7 x64
    Thread Starter
       #22

    Gotcha, thats kinda what I figured.

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

    COSenna
      My Computer


  3. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #23

    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
    Deleting mass files ending in specific characters Attached Files
      My Computer


  4. Posts : 26
    Windows 7 Ultimate x64
       #24

    Pyprohly said:
    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 Computer


 
Page 3 of 3 FirstFirst 123

  Related Discussions
Our Sites
Site Links
About 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 08:06.
Find Us