# Delete Non Audio Files

This function is used to delete non audio files from the folders containing the selected tracks. This function can also delete contained empty folders. An empty folder is a folder with no contents or only hidden contents.

This function will not delete audio files handled by Yate, contained folders which are not empty, or hidden files.

Note that audio files of types not handled by Yate may be deleted.

For the purposes of this documentation a file specification is either a file or an empty folder.

You specify specific files or types of files to be moved in the Delete files... field by separating the items with slash characters (/). Non leading and trailing spaces are significant. For example:

> txt/pdf/folder.jpg

The above example will delete files with filename extensions of txt and pdf. It will also delete files named folder.jpg.

Items in the list can be forced to match only file types by starting the item with a period. Items in the list can be forced to match only files by ending the item with a period. Forcing the match type should only be necessary in extreme cases. For example:

> txt./.jpg

The above example will delete files named txt and any file with a file type (extension) of jpg.

If you want to remove all empty contained folders, specify a file type of *:

If you want to remove all non audio files, specify a file type of *

> */*:

will delete all non audio files and all empty folders.

You can specify files or folders that are to be excluded from being deleted. You specify a list of files separated by slash characters (/). Non leading and trailing spaces are significant. For example:

> file list.txt/cover booklet.pdf

Alphabetic case is ignored when processing.

Any errors while deleting the files or folders are ignored.

Note that deletions occur immediately. The operation cannot be undone!

While this function is available in all execution modes it is far more efficient when executed in stepwise mode.

Both of the supplied strings may contain any of the escape sequences described in Escape Sequences. This means that you can control the items to be deleted at runtime. Note that the escape sequences are only evaluated once while running stepwise.

If the Deep option is enabled, subfolders are processed with the same rules.

The exact algorithm for determining which items get deleted is as follows:

1. If an item starts with a '.', it is a hidden file and is ignored.
2. If an item has the invisible attribute, it is ignored.
3. If an item is an audio type handled by Yate, it is ignored.
4. If an item is a non empty folder, it is ignored. An empty folder is any folder which has no contents or only hidden contents.
5. If an item cannot be matched against an entry in the Delete files... list it is ignored. A match can be a full filename match or a file type (extension) match. Any file can be matched against *. Any empty folder can be matched against *:
6. If an item is matched against an entry in the Exclude files... list, it is ignored. A match can be a full filename match or a file type (extension)
7. The item is deleted.

Tip: if you want to use this functionality to process your entire collection, this is one of those few times where using the Batch Processor might not be the best method. When the Batch Processor is run, only those folders containing audio files are processed. If you have a parent folder for a multi-disc album with sub folders containing the per disc audio files, the parent folder will not be processed. A better method would be to load a single file in your collection's root folder. If you do not have any audio files there, you can always temporarily put one there. Run your action in the UI on the single file. If the deep option is specified, every sub-folder will be processed regardless of the presense of audio files.