How to move files containing a specific text recursively

Today we’ll see how we can move files that contain a particular word, a specific directory/subdirectories, recursively. Sometimes we may need to move files that meet a certain pattern to a particular folder.

For example, imagine that we have a directory/subdirectories with thousands of audio files, with metadata in the filename and we want to make an automatic selection of all the audio files that contain the word SALES in the name tag. We could go directory to directory looking for the word SALES and cutting and pasting in a folder or we could use the Windows search and give us the results, but sure that the following command can be more than useful.

Copy this code, save it in a bat file and run it. It will automatically dump all mp3 audio files containing the word SALES in the C:\SALES_AUDIO\ folder.

From here we can apply this small code to any example you can think of.

I hope it will help you;)

Sergio Martín
Más de seis años de experiencia gestionando equipos y proyectos de Business Intelligence para diferentes sectores, apasionado de todos los procesos técnicos relacionados con la gestión de la información, el tratamiento de datos y la automatización de procesos

** Microstrategy 9.4 | Pentaho 5 (ETL) | Oracle 11g **

Leave a Reply

Your email address will not be published. Required fields are marked *