I am attempting to delete redundant copies of WMA and M4A files in my iTunes media music folder, and I don't want to have to perform thousands of manual deletions. Each redundant copy has an appended parenthetical in its filename starting with a date, viz. "(2017_12_", so I am using the command

del /s <<path>>*(2017_12*.*

The cmd window returns each filename followed by "Access is denied." on the next line. I am running as administrator, I had just restarted, and nothing that obviously might have a hold on the files was running (I closed a couple of idle iTunes processes).

Is there something I can do to gain access to the files in the command line without a third-party application? Would a batch process, or something else native, allow me to do what the command line is not?

  • I accomplished the cleanup task by searching for (2017_12 in File Explorer, selecting all results, and deleting, but I would still like to know if it is possible to do from the command line. – PatentWookiee Dec 18 '17 at 21:22
  • You probably need to escape the ( using ^( instead. – DavidPostill Dec 18 '17 at 22:07
  • Apparently not so, as the process identified thousands of files, just could not delete them. – PatentWookiee Dec 19 '17 at 2:45

If the file is used by another process, or, if you do not have appropriate permission on it, it may cause problem when delete them.

Please open file PropertiesSecurity, make sure that current user account has full permission on it.

Then, re-start system in Clean Boot, disable any 3rd party process at start up, or, you can also try to re-start system in Safe Mode, do not manually start any 3rd party process. Then, open CMD with admin permission and try the delete command again to check the result.

You may try command line as below:

Cd "your folder location" //navigate to folder location

Dir *.wma *.m4a //display all file with specific file type

Del /s 2017_12.* //delete file which name includes 2017_12

Dir *.wma *.m4a //display all file with specific file type and confirm that if specific file has been deleted

I had tried to delete .txt file which name including “2017_12” under location “C:\New Folder”: enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.