SOLVED Script (Batch File) Writing...

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
Well How?

I'm not afraid to dig deep and change system files (Hell, I re-designed my XP totally), but I'm trying to write an "automated" way of renaming files.

All i want to do is prefix a file with a tilde (~).
This is for Photoshop, a tilde (~) stops Photoshop searching/displaying the file.

Every site I've tried shows me how to add/remove dates/numbers etc. etc. but nothing related to what I want to do, or even actually explaining what a "/" or "@" or "echo" or "U taken t'dog fe 'is walk?" does.
Well, actually the last one's self explanatory, S.W.M.B.O has just spoken!!

As an example I want to re-name Dicom.8bi to ~Dicom.8bi., wherever it may be, I'll add the "Addresses", which would be fixed, not a wild card search.
That would be one of many, in different folders, 64-bit and 32-bit etc. etc. But I'm fed up of going through and manually renaming them all. When I say manually, what I mean is:- Open folder, Highlight files to be renamed, use drag'n'drop onto a Better File Rename.dpt I've made to add tilde (~) to the start.
I need some pointers, my(??) script (below) was (AHEM!!) borrowed and amended from others. It runs OK (Now? HOW?) but does nothing??? As in, the commands work, BUT, I don't know why.

I think that's my biggest niggle, if you don't know why/how/what for, how can you ever understand / advance ????

I can add/edit the full addresses as need be, it's basically the "correct re-name" function/syntax(?) I'm looking for.

THIS WORKS!!
@echo off
cls
set windrive=%1
echo The Adobe installed Plug-ins and Presets listed in the "Read Me" file will
echo will be pre-fixed with a tilde (~) which will disable/hide them.
echo.
echo Do you wish to continue?
set /p choice=Please press "Y" for yes or "N" for no:
if %choice%==y goto moveon
if %choice%==n goto dontmove

:moveon
THIS DOESN'T WORK/DOES NOTHING :confused: :bawling:
ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Cineon.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Cineon.8BI"
ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Dicom.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Dicom.8BI"ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\TRUMATCH.acb" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\~TRUMATCH.acb"
ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\VisiBone2.acb" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Presets\Color Books\~VisiBone2.acb"
THIS WORKS !! (leads on from Pt. 1)
echo .
echo .
echo Whoopy Doo!!! Won't be seeing those again unless you want to! :)
echo .
pause
exit /B n


:dontmove
echo .
echo The Batch File execution has been cancelled.
pause
Oh, And if you know of a good "Batch writing Tut" site, FFS!, don't be shy, let me know.
And I'll accept any offers to help me write the scripts I want.
As for my past offerings for assistance saying I'll have your children if you help, that offer is withdrawn. Somebody, (And you know who you are!! No names etc.. etc..) dived in just a tad too fast!!!
 
Last edited:

Fire cat

Established Member
Joined
Mar 7, 2010
Messages
1,157
Reaction score
191
Hi Elmer!
Get rid of the quotes around the files. I tested the code, and this is the results:
This doesn't work:
ren "file.txt" "file.~txt"
On the other hand, this does work:
ren file.txt file.~txt
So the quotes are the problems. Get rid of them and you should be OK.

Cheers,
Fire Cat
 
Joined
Mar 8, 2009
Messages
5,063
Reaction score
1,185
Get rid of the quotes around the files.
This is not good advice. The quots are necessary for long filename support, especially when a space is included in the name.

Elmer have you considered using any batch renaming tools. If my file manager (Total Commander) didn't have this feature built in, I might would try using Irfanview. If these programs still do not suit you, I can help with your batch script.
 

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
Hi Elmer!
Get rid of the quotes around the files.
So the quotes are the problems. Get rid of them and you should be OK.
This is not good advice. The quotes are necessary for long filename support.
What I have at the moment for example is:-

ren MMXCore.8BX ~MMXCore.8BX
ren "MultiProcessor Support.8bx" "~MultiProcessor Support.8bx"


That is in an individual batch file placed inside the folder that contains the files it needs to re-name, hence I don't need to have the "address" in the re-name line. I don't have all the fancy stuff either, just wanted to see if I could get that to work!!
So I have several of these batch files now dotted in various folders throughout the Adobe System.
I was hoping to accumulate them into one batch file that would deal with them all in only one double-click.

Elmer have you considered using any batch renaming tools. If my file manager (Total Commander) didn't have this feature built in, I might would try using Irfanview. If these programs still do not suit you, I can help with your batch script.
Does it really have to be done in a batch file? I use a freeware product WildRename which I find easy to use and allows me to rename entire folders of my digital photos.
http://www.cylog.org/utilities/wildrename.jsp?version=v2.15
I'll look into those progs. Anything I have looked at so far has only let me attend to one folder at a time and, to be honest, it would be quicker to go to that folder and re-name the files individually. It would be handy if I could just give it a list of files with their locations and tell it to go deal.

By having a (parent/main) batch file:-
a) I don't have to open a list of the files I want to re-name then open the various folders, drag'n'drop the files onto my Better File Rename droplet OR double-click individual batch files etc. etc..
b) Although this may only be needed (usually) 2 or 3 times a year, any piece of automation after a system re-install has to be seized with both hands.
c) The most important point, I'm (nearly!!) learning something, gotta keep the ole grey matter on the go at my age, don't ya know!!
 
Last edited:

TrainableMan

^ The World's First ^
Moderator
Joined
May 10, 2010
Messages
9,361
Reaction score
1,587
WildRename allows you to recurse subdirectories (repeat the processing on every folder under the current folder) so even if you wanted it to rename those two files in every folder on your HD it would be simple to set it to C:\ and check "Recurse into subdirectories".
 
Joined
Mar 8, 2009
Messages
5,063
Reaction score
1,185
Elmer, I have one question before I can help further.

Do the files have anything in common such as the file name or file extension?
 
Joined
Jun 25, 2010
Messages
4
Reaction score
1
Well How?

I'm not afraid to dig deep and change system files (Hell, I re-designed my XP totally), but I'm trying to write an "automated" way of renaming files.

All i want to do is prefix a file with a tilde (~).
This is for Photoshop, a tilde (~) stops Photoshop searching/displaying the file.

Every site I've tried shows me how to add/remove dates/numbers etc. etc. but nothing related to what I want to do, or even actually explaining what a "/" or "@" or "echo" or "U taken t'dog fe 'is walk?" does.
Well, actually the last one's self explanatory, S.W.M.B.O has just spoken!!

As an example I want to re-name Dicom.8bi to ~Dicom.8bi., wherever it may be, I'll add the "Addresses", which would be fixed, not a wild card search.
That would be one of many, in different folders, 64-bit and 32-bit etc. etc. But I'm fed up of going through and manually renaming them all. When I say manually, what I mean is:- Open folder, Highlight files to be renamed, use drag'n'drop onto a Better File Rename.dpt I've made to add tilde (~) to the start.
I need some pointers, my(??) script (below) was (AHEM!!) borrowed and amended from others. It runs OK (Now? HOW?) but does nothing??? As in, the commands work, BUT, I don't know why.

I think that's my biggest niggle, if you don't know why/how/what for, how can you ever understand / advance ????

I can add/edit the full addresses as need be, it's basically the "correct re-name" function/syntax(?) I'm looking for.

THIS WORKS!!THIS DOESN'T WORK/DOES NOTHING :confused: :bawling:THIS WORKS !! (leads on from Pt. 1)Oh, And if you know of a good "Batch writing Tut" site, FFS!, don't be shy, let me know.
And I'll accept any offers to help me write the scripts I want.
As for my past offerings for assistance saying I'll have your children if you help, that offer is withdrawn. Somebody, (And you know who you are!! No names etc.. etc..) dived in just a tad too fast!!!
try a carat
eg
ren c:\cookies.txt ^~cookies.tx
a ^ carat tell batch files to ignore the next character as an instruction,
its just a character
 

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
WildRename allows you to recurse subdirectories (repeat the processing on every folder under the current folder) so even if you wanted it to rename those two files in every folder on your HD it would be simple to set it to C:\ and check "Recurse into subdirectories".
Thanks for this pointer TM. Although I'm struggling to get it to do what I want to do here (beginners ignorance), I've already made use of it elsewhere. So it's now been added to my "Stand-Alones To Keep" folder!!

Elmer, I have one question before I can help further.

Do the files have anything in common such as the file name or file extension?
There are some duplicates in different locations, mainly because I still run my old PS CS3 but they are not all say ".abc" file extensions. I'm attaching a list with the address of each individual "rename" batch file.

Give me a while and I'll add the list, the dog's decided it's time to go to the Offy, ready for later!!
 
Last edited:

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
Elmer, I have one question before I can help further.

Do the files have anything in common such as the file name or file extension?
Clifford, I've attached the "full" list of the files I want to rename. Some of these I'll have to remove from the list as and when, but I think I'll do better to start full and walk backwards as reqd.
I've split them into the four main groups or parent program folder with ===========.

BTW. The dog didn't really want to go for a walk to the Offy, but I thought, what the heck, "Two birds. One stone"

try a carat
eg
ren c:\cookies.txt ^~cookies.tx
a ^ carat tell batch files to ignore the next character as an instruction,
its just a character
I had to read that 3 or 4 times before it sank in. :eek: Missing 't' on end of second 'txt' :dontknow: threw me a wobbly!! ;)
But about the carat is something else I've learnt!! :proud: Never thought that a tilde was actually a "command", even though I've lost count of the times I've read "Docu~1" or something like that.
 

Attachments

  • 9.2 KB Views: 1,360
Last edited:
Joined
Mar 8, 2009
Messages
5,063
Reaction score
1,185
The txt file was all I needed. :)

Hope this helps
  • Zip file contains
    • One slightly modified txt file from the one you provided.
    • One CMD file that uses the modified file to rename every filename listed.
If you read the top few lines in the modified txt file you will see the pattern that I created. You can add or remove any file in the list to be renamed.

Simply click the Rename.cmd file to start the script. However if you don't understand what is written within the script, you should always ask someone else to look it over before you start the script. I'm simply suggesting scripts are dangerous and should never be run unless you know for sure exactly what the script will do.


View attachment Rename.zip
 
Last edited:

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
The txt file was all I needed. :)

Hope this helps
  • Zip file contains
    • One slightly modified txt file from the one you provided.
    • One CMD file that uses the modified file to rename every filename listed.
If you read the top few lines in the modified txt file you will see the pattern that I created. You can add or remove any file in the list to be renamed.

Simply click the Rename.cmd file to start the script. However if you don't understand what is written within the script, you should always ask someone else to look it over before you start the script. I'm simply suggesting scripts are dangerous and should never be run unless you know for sure exactly what the script will do.
Now I am confused Clifford, I can't see a zip file!!
A) It's Sunday
B) I live next door but one to a pub where everybody is dieing after the (alleged) match. Moi, aussi!!
C) Still Sunday!!

DOH!!! Log in FIRST helps!!!

You saying I can't trust you (final paragraph)?
Actually wise words indeed. You know when you visit a site like (for example) askVG, and there is no defamation meant here, instead of downloading the "ready-made registry tweak" I'd rather type it in manually and export it for later use.

Because this is now a sort of a retro thing, i.e. I'd already re-named the files with a pre-fixed tilde, I went through the folders/files and randomly "un-renamed" them. Then hit your rename cmd. Worked a treat Pal, but then, you knew it would!!! THANKYOU, THANKYOU, THANKYOU.

Did I remember to say Thanks?????

Admin I don't seem to be able to mark this thread as solved. Is that because I'm in a "non-problem" solving side of the forum?? (Or is it because the beer's still working :beer: ??)
 
Last edited:
Joined
Mar 8, 2009
Messages
5,063
Reaction score
1,185
Now I am confused Clifford, I can't see a zip file!!
That would be my fault. :eek: It was 50 minutes later when I realized I had not uploaded the file yet.

Did I remember to say Thanks?????
You are very welcome. I happy that it works for you. :)

Admin I don't seem to be able to mark this thread as solved. Is that because I'm in a "non-problem" solving side of the forum?? (Or is it because the beer's still working :beer: ??)
That option does not work in the Off Topic section. I moved the thread and then flagged it solved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top