Modifying -d %y%m%d-%%-4f.%%e for a batch file

Started by Tarn, February 28, 2013, 01:40:11 PM

Previous topic - Next topic

Tarn

Using the files: "_1282937.JPG"; and "_1282937.ORF"

As expected" -d %y%m%d-%%-4f.%%e -Filename"<$DateTimeOriginal" . produces a file called "me". Because it's a batch file, I need to add an extra "%" in the code. So...

-d %%y%%m%%d-%%%-4f.%%%e -Filename"<$DateTimeOriginal" produces "130228-JPG" "130228-ORF"
-d %%y%%m%%d-%%-4f.%%e -Filename"<$DateTimeOriginal"    produces "130228-4f" and an error "130228-4f already exists"
-d %%y%%m%%d-%%%-4f.%%e -Filename"<$DateTimeOriginal"   produces "130228-" and an error "130228- already exists"
-d %%y%%m%%d-%%-4f.%%%e -Filename"<$DateTimeOriginal"   produces "130228-4f" and an error "130228-4f already exists"
What am I doing wrong?

My goal is to turn "_1282937.*" into "130228-2937.*". Essentially, I want to strip the camera's date code "_128" out; put the files's DateTimeOriginal (in the yymmdd format) as the first part of the file name; add a dash "-" after that; leave the last 4 digits of the filename in place; and end up with the same extion as the original file.

I'm only dealing with two file type; JPG, and ORF. I can do this from the dot prompt, or command line; but I have over 500 sub-directories to do this with.
I'm all ears.

Phil Harvey

You need 4 %'s... like this: %%%%-4f

Doubled twice.  Once to get through the -d option, and again to get through the BAT command parser.

But one command will do all 500 files, so I don't see why you need a BAT file.  Just specify the directory name.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Tarn

Dooogh!!! Not enough "%"s.

I know, and understand that one command will work on 500, or more files. But I'm a little shy about releasing any command on 18,000+ files. If something goes wrong, re-copying that many files could easily eat up a couple of hours. Part of my work flow is to go in and double check each directory before doing a batch file. Make sure that there are no odd files, make sure that I don't have an edited file called "Esparanza sunrise.jpg" that's going to get re-named to "070106-1955.JPG" and end up lost in the pile. Just make sure that all the files are read to be worked on.

I like to process five to ten folders; do everything that needs to be done with them; then put them away. That way I know that everything is done and there will be no "Oh dang!" later on.

Sadly, I'm the guy that things happen to. You may have heard about "Murphy's Law"... well it's a way of file for me. I've had things go wrong in batch processing that people have never heard of. Nothing wrong with the batch file, just "something" went wrong with the files. So I tend to be cautious on how many files I batch at one time.

Also, even though I could (if I weren't so chicken) process all my files at once; I will be having more files to work on in the future as I still have the E500, and a 5050.

Thank you, again, for the info. I just didn't think about trying a fourth "%".