Last Updated:

Executing Commands on All Files in a Folder

Run a Command Against All Files in a Folder

How to rename all files in a folder:

For a very long time, Microsoft Windows did not ship with Powershell. In fact, it did not ship with any kind of shell and all.

So, when Windows users would ask me about Linux, or any other operating systems, that was one of the main things I would point out to them. At least, if they were "tech savvy", the raw power of having a shell versus "just a command prompt". And how scripting in the command line, on the fly is invaluable. I'm sure it's invaluable everywhere, but I found it especially invaluable in the security world

Here's a one line command to create a "for loop" and execute that command on each file found in a particular folder:

for i in *;mv "$i" "$i.conf"; done

Yup, it's that easy in BASH.

The above command will iterate (duh) the 'move file' command and append '.conf' to the end of the filename, by "moving" those files to the same folder but with .conf added to their name. Yes, it does essentially just rename them.

You're welcome and remember to wash your hands.