Could someone help me with a script that would do something like this:
o1. Select all files that needs to be renamed.
o2. A window pops up asking to input Beginning Increment Renaming Value.
o3. Adds a period after the Increment.
o4. A window pops up asking for a new filename.
o5. Keeps the extension as is.
o6. Make everything lowercase.
o7. Starts the renaming.
The before and After result would look something like this:
Before:
awedaefa.txt
rgaweW.TXT
SAWESFAER.txt
wefesrgg.txt
eartgear.txt
thserger.txt
After:
00001.samplefile.txt
00002.samplefile.txt
00003.samplefile.txt
00004.samplefile.txt
00005.samplefile.txt
00006.samplefile.txt
P.S. what's the command to "changes all space to ."
i noticed that XYplorer already has the "change all spaces to _" but I need the "." instead.
TIA
Need a Script.
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: Need a Script.
Hi and Welcome!Member wrote:Could someone help me with a script that would do something like this:
o1. Select all files that needs to be renamed.
o2. A window pops up asking to input Beginning Increment Renaming Value.
o3. Adds a period after the Increment.
o4. A window pops up asking for a new filename.
o5. Keeps the extension as is.
o6. Make everything lowercase.
o7. Starts the renaming.
The before and After result would look something like this:
Before:
awedaefa.txt
rgaweW.TXT
SAWESFAER.txt
wefesrgg.txt
eartgear.txt
thserger.txt
After:
00001.samplefile.txt
00002.samplefile.txt
00003.samplefile.txt
00004.samplefile.txt
00005.samplefile.txt
00006.samplefile.txt
Here is a simple script:
Code: Select all
//Enter increment
input $increment, "Enter Increment value", 000001;
//Enter filename
input $name, "Enter file name", name;
//Rename command
rename b, "<#$increment>.$name";
//Convert all to lowercase
#127;
Member wrote: P.S. what's the command to "changes all space to ."
i noticed that XYplorer already has the "change all spaces to _" but I need the "." instead.
TIA
Code: Select all
//rename (with preview) space to .
rename s, " /.", p;
Re: Need a Script.
Wow, thank you so much serendipity.
It works like a charm. I was trying to figure it out myself, yet you make it look so simple.
May I ask where did #127 come from? Or what it's called.
Edit: Nevermind, it's called a Command ID.
It works like a charm. I was trying to figure it out myself, yet you make it look so simple.
May I ask where did #127 come from? Or what it's called.
Edit: Nevermind, it's called a Command ID.
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Re: Need a Script.
Hi and another welcome to the XY forums! And thanks again for making that change to your ID!Member wrote:Wow, thank you so much serendipity.
It works like a charm. I was trying to figure it out myself, yet you make it look so simple.
I started looking at what you wanted and then realized that I didn't know scripting enough to answer but figured one of our experts would do so, and as you saw, serendipity did...I'm better at handing the more mundane queries here and such...but together, we all hopefully provide what others need, whether they be first-timers or regulars.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
Re: Need a Script.
Definitely, thanks j_c_hallgren for the kind welcome and assistance even though I am a new member. I have to say, this is a great community and a very good resource area. Keep up the great work you guys!j_c_hallgren wrote:Hi and another welcome to the XY forums! And thanks again for making that change to your ID!Member wrote:Wow, thank you so much serendipity.
It works like a charm. I was trying to figure it out myself, yet you make it look so simple.
I started looking at what you wanted and then realized that I didn't know scripting enough to answer but figured one of our experts would do so, and as you saw, serendipity did...I'm better at handing the more mundane queries here and such...but together, we all hopefully provide what others need, whether they be first-timers or regulars.
Edit:
Could someone further help me on this script? I was wondering how I can make the script below to perform on sub directories and files as well. Again, thanks to serendipity I can understand how the script works. Don't laugh because I know the script is a mess, but it works. Lol.
Code: Select all
//Replace dashes ( - ) to period ( . )
rename s, "-/.";
//Replace underlines ( _ ) to period ( . )
rename s, "_/.";
//Replace commas ( , ) to period ( . )
rename s, ",/.";
//Replace spaces to period ( . )
rename s, " /.";
//Replace quintuple periods ( ..... ) to period ( . )
rename s, "...../.";
//Replace quadruple periods ( .... ) to period ( . )
rename s, "..../.";
//Replace triple periods ( ... ) to period ( . )
rename s, ".../.";
//Replace double periods ( .. ) to period ( . )
rename s, "../.";
//Convert all to lowercase
#127;Re: Need a Script.
i haven't tested it, but this should work on all files and sub-dirs of the current folder.Member wrote:Could someone further help me on this script? I was wondering how I can make the script below to perform on sub directories and files as well.
Code: Select all
#263; //show all items in branch
sel a; //select all items
setting RegexpRenameSep,'>>';
rename r,'[_, -]|\.{2,}>>.';
#127; //Convert all to lowercasethe script will also replace more than 5 consecutive periods.
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...
Re: Need a Script.
Hello Muroph,Muroph wrote:i haven't tested it, but this should work on all files and sub-dirs of the current folder.Member wrote:Could someone further help me on this script? I was wondering how I can make the script below to perform on sub directories and files as well.all those rename commands were replaced by a single regex.Code: Select all
#263; //show all items in branch sel a; //select all items setting RegexpRenameSep,'>>'; rename r,'[_, -]|\.{2,}>>.'; #127; //Convert all to lowercase
the script will also replace more than 5 consecutive periods.
I tried that script but it doesn't work. A lot of the sub files and folders are randomly named correctly as well as not being named at all. I like your approach to this script... Showing all items in a branch and then renaming them. I'll take a look at the code and see if I can rework it, although it'll be be hard for someone without any scripting knowledge. Thanks again Muroph.
XYplorer Beta Club