View Full Version : Bat file question...
03-18-2004, 07:23 PM
We just rendered out a crapload of frames but now I have a problem. The cell padding is at the front and back and I'm trying to write a bat file just to remove the first 4 digits. I've gotten it to remove the 4 digit extension with the dot (.jpg) and everything up to the .jpg. I just can't get it to take out the first four characters. Anyone that can give me a real quick solution to this would be rewarded with wine, women and dance!
03-18-2004, 07:25 PM
It would be rally helpful to see how you have tried to solve the problem, so posting a code-snippet would be great ;)
03-18-2004, 08:00 PM
We tried multiple variations on this:
rename 0*_*.* *.*
This was to take the first 3 digits and the underscore off and then just leave the left overs. Well, it doesn't work that way. We found that it HAS to have something to replace with whatever it's taking away for some weird reason with this convention. I think with us removing the file extension and the everything but the file extension it was just us slamming it with something it couldn't understand and it was trying to make due.
03-19-2004, 08:04 AM
Windows batch files are the poorest excuse for a scripting system. Ever.
You may want to do it using the tools you've got already, but I'd highly advise getting python. You can do this and a million more things much more easily, and with a much prettier syntax:
for filename in os.listdir( '.' ):
rename( filename, filename[4:] )
running that in the current directory will rename everything to its current filename, minus the first four characters.
For an even more pleasant scripting experience, get cygwin as well.
03-19-2004, 12:49 PM
Yeah, I would like to use something more versitile but it's really difficult for us to install stuff here at work. We have NO ADMINISTRATIVE privelidges whatsoever and from my understanding we need to install Python in order to utilize it right?
I've never messed with Python so I don't know if we need the modules to run the script you just posted. I just went to this place (http://www.dickbaldwin.com/python/Pyth0001.htm) to read a quick description and I did download the module from Python.org.
03-19-2004, 01:44 PM
O.K. We were able to install it anyways on two of our comps. Do we need to compile the script and execute within the directory we want to have the files renamed?
03-19-2004, 01:58 PM
you just need to make sure you have the bin directory of the python installation in your path, then do
in the directory where the jpgs are.
03-19-2004, 02:00 PM
There are several freeware utilities out there that perform this type of task. I don't remember the name of the one I have used in the past, but here is one I found this morning.
01-17-2006, 06:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.