Question

I have thousands of html file in a directory. I wanna extract files that contain Chennai in the file name and put it into another folder. I am sure it is possible. I am not close enough to copy the files to another folder.

Was it helpful?

Solution

Use globbing:

mv *Chennai* target/

If the file names might start with a dot, use

mv .*Chennai* *Chennai* target/

OTHER TIPS

Try:

find directory_with_htmls -type f -name "*Chennai*.html" -exec cp {} some_other_folder \;

This would copy html files in the directory_with_htmls directory containing Chennai in the name to the directory some_other_folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top