Rename File

Discuss and share scripts and script files...
Post Reply
Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Rename File

Post by Ysl »

Hi

I would like to be able after selecting a file to push a key and it will be renamed to "cover"

So that xyz.jpg will become cover.jpg (the same with *.bmp files)

This seem simple but I did not found how to do it with User manager Command so maybe it would work with a script but for that, I need your help as I'm don't know how to write a script...

Thanks

ysl

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Rename File

Post by zer0 »

Here's a quick script that will rename all files to cover.<ext>, not just JPEGs and BMPs. If you need it to apply to just those types then drop me a line and I'll add another one for that

Code: Select all

"Rename to Cover"  rename s, "<curbase>/cover";
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Rename File

Post by Ysl »

Works great like this !

Thank you very much !

Ysl

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Rename File

Post by admin »

zer0 wrote:Here's a quick script that will rename all files to cover.<ext>, not just JPEGs and BMPs. If you need it to apply to just those types then drop me a line and I'll add another one for that

Code: Select all

"Rename to Cover"  rename s, "<curbase>/cover";
This does it simpler:

Code: Select all

"Rename to Cover" rename , "cover";
:)

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Rename File

Post by Ysl »

May I ask for an improvement in this script..

which will :

Copy the selected file in the same folder and then rename it to cover.jpg

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Rename File

Post by admin »

Ysl wrote:May I ask for an improvement in this script..

which will :

Copy the selected file in the same folder and then rename it to cover.jpg
Try this:

Code: Select all

copyitem , "cover.jpg";

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Rename File

Post by TheQwerty »

admin wrote:Try this:

Code: Select all

copyitem , "cover.jpg";
I'd suggest using this instead:

Code: Select all

copyitem , "cover.?";
That way you can use it on other image types without blowing away the proper extension.

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Rename File

Post by Ysl »

Thanks again !

Post Reply