Saturday 10 November 2018

windows - Is there a way to batch rename files to lowercase?


I need a way to rename all files in folders and subfolders to lowercase.


I'd like to know if there is a way to do that using only windows (XP or 7)



Answer



Go to the directory and run the following command:


for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")



Here is the break-down in case someone wants to modify/improve :



  • for /f - For every line

  • "Tokens=*" - Process each item in every line.

  • %f in (...) - %f is your variable name for every item.

  • dir - lists every file and subdirectory in a directory.

  • /l - (parameter for dir) Uses lowercase.

  • /b - (parameter for dir) Uses bare format, only the file/directory names, no size, no headers.

  • /a-d - (parameter for dir) Do not list directories. (a stands for attribute, - stands for not and d stands for directory).

  • rename "%f" "%f"- rename the file with its own name, which is actually lowercased by the dir command and /l combination.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...