I copy my raw files from the sd card and put it in /volume/macssd/A6300, my purpose is to create a script which will create sub directories based on the datetimeoriginal and move all the raw files there.
in osx i have created a script with following command in /volume/macssd/A6300,
exiftool -d %Y-%m-%d "-Directory<datetimeoriginal" -ext ARW . {dot to represent current directory}
this command doesn't do anything but if I use
exiftool -d %Y-%m-%d "-Directory<datetimeoriginal" -ext ARW /volume/macssd/A6300
it will create the sub folders in my Home directory instead of /volume/macssd/A6300
what is the correct way? do I have to hard code the directory name?
According to what you said, this is what you want:
exiftool -d /volume/macssd/A6300/%Y-%m-%d "-Directory<datetimeoriginal" -ext ARW /volume/macssd/A6300
But if you are on Mac, the volumes are under "/Volumes", not "/volume", so you should pay attention to details like this.
- Phil
Thanks, I was experimenting and this works
exiftool '-directory<%d/${datetimeoriginal}' -d %Y-%m-%d -ext ARW /Volumes/macssd/A6300
my main question is can I make this universal so that I can copy his file in any other directory and it should work, I don't want to hard code the directory name. this file will always reside in the base folder where it will run.
The problem is solved if it recognise . (dot) as the current folder.
exiftool -d "%%Y-%%m-%%d" "-directory<datetimeoriginal" ./*.ARW
the above line works perfectly in windows but not in OSX
It will work only in a Windows .bat file. On the Windows or Mac command line you don't need the double "%" signs.
- Phil
The following works in OSX.
I create a text file AMoveit.command in the directory where I copy my Sony raw files from the SD card with the following line
exiftool '-directory<%d/${datetimeoriginal}' -d %Y-%m-%d -ext ARW "${0%/*}"
and make the file executable by
chmod u+x AMoveit.command
after copying the file I double click AMoveit.command and this will create directories based on the date the picture was taken and move the file to this directory.
This can work for any camera and file type by providing appropriate file extension/s instead of ARW in above code.
Can directory where files are moved have name of first file that copied to it (without the extension)?
Something like this:
exiftool -d "$filename" "-Directory<datetimeoriginal" -ext ARW imagesfolder
This is tricky because ExifTool doesn't normally maintain information between processed files. However, it can be done like this:
exiftool "-directory<${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}" -ext arw DIR
The advanced formatting expression above creates a global "$myvar" variable to remember the base name of the first processed file. Note that this will create the directory in the current folder, but you can add a destination folder to the command like this:
exiftool "-directory<c:/some/destination/folder/${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}" -ext arw DIR
Also note that the order the files are processed is system dependent, so the first one may not be what you expect. If necessary you can use the -fileOrder option to force a specific order. For example, to process the files in order of the sorted file names:
exiftool "-directory<c:/some/destination/folder/${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}" -ext arw -fileorder filename DIR
- Phil
Quote from: Phil Harvey on December 20, 2022, 07:42:36 AMexiftool "-directory<c:/some/destination/folder/${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}" -ext arw -fileorder filename DIR
- Phil
Thank you for answer. I run command in Linux (android phone) and getting error its beyond my knowledge how to make it work.
exiftool "-directory<${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}" -ext arw -fileorder filename temp
bash: -directory<${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}: bad substitution
See my signature.
- Phil
Quote from: Phil Harvey on December 20, 2022, 07:42:36 AMexiftool "-directory<c:/some/destination/folder/${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}" -ext arw -fileorder filename DIR
Hi Phil, made this command run thanks to your explination, however exiftool places all stacks in one folder. Folder name is of first image file minus extension.
Id appreciate any feedback.
What command shell are you using? Did you read my signature? What is the exact command you used?
- Phil
Quote from: Phil Harvey on December 28, 2022, 08:45:41 AMWhat command shell are you using? Did you read my signature? What is the exact command you used?
- Phil
Hi Phil i use bash shell trough Termux app.
exiftool '-directory<${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}' -ext arw raws
This command should work as I intended. I don't understand the problem.
Quote from: JobWellDone on December 20, 2022, 06:40:33 AMCan directory where files are moved have name of first file that copied to it (without the extension)?
You want the name of the directory to be that of the first file copied to it. Right.
Quote from: JobWellDone on December 22, 2022, 09:07:17 PMHi Phil, made this command run thanks to your explination, however exiftool places all stacks in one folder. Folder name is of first image file minus extension.
I thought this is what you wanted.
- Phil
Quote from: Phil Harvey on December 29, 2022, 06:43:57 AMThis command should work as I intended. I don't understand the problem.
I thought this is what you wanted.
Example i have three stacks total 9 files, when i run the command all three stacks get copied in one folder, not three separate folders.
Before Exiftool
\arw\DCIM0001.ARW
\arw\DCIM0002.ARW
\arw\DCIM0003.ARW
\arw\DCIM0004.ARW
\arw\DCIM0005.ARW
\arw\DCIM0006.ARW
\arw\DCIM0007.ARW
\arw\DCIM0008.ARW
\arw\DCIM0009.ARWI normally organize bracketed into stack like this
exiftool -d "%Hh-%Mm_(%Ss)" -Directory<datetimeoriginal" -ext ARW arw\arw\15h-58m_(02s)\DCIM0001.ARW
\arw\15h-58m_(02s)\DCIM0002.ARW
\arw\15h-58m_(02s)\DCIM0003.ARW
\arw\16h-01m_(34s)\DCIM0004.ARW
\arw\16h-01m_(34s)\DCIM0005.ARW
\arw\16h-01m_(34s)\DCIM0006.ARW
\arw\16h-01m_(35s)\DCIM0007.ARW
\arw\16h-01m_(35s)\DCIM0008.ARW
\arw\16h-01m_(35s)\DCIM0009.ARWWanted to have option to use file name instead of time for stack folder name.
After
exiftool '-directory<${basename;use vars q($myvar);$myvar or $myvar=$_;$_=$myvar}' -ext ARW arw\arw\DCIM0001\DCIM0001.ARW
\arw\DCIM0001\DCIM0002.ARW
\arw\DCIM0001\DCIM0003.ARW
\arw\DCIM0001\DCIM0004.ARW
\arw\DCIM0001\DCIM0005.ARW
\arw\DCIM0001\DCIM0006.ARW
\arw\DCIM0001\DCIM0007.ARW
\arw\DCIM0001\DCIM0008.ARW
\arw\DCIM0001\DCIM0009.ARWExpected result is:
\arw\DCIM0001\DCIM0001.ARW
\arw\DCIM0001\DCIM0002.ARW
\arw\DCIM0001\DCIM0003.ARW
\arw\DCIM0004\DCIM0004.ARW
\arw\DCIM0004\DCIM0005.ARW
\arw\DCIM0004\DCIM0006.ARW
\arw\DCIM0007\DCIM0007.ARW
\arw\DCIM0007\DCIM0008.ARW
\arw\DCIM0007\DCIM0009.ARWDifference between this question and my other thread (https://exiftool.org/forum/index.php?topic=14302.0) is that in this cellphone camera all images in stack always marked with same timestamp so no need to make any complex checks just group by DateTimeOriginal.
P.S. Pardon if i confused you i am currently been using my cellphone instead of computer and sometimes i get lost with all the new interface and tiny screen so i might have misrepresented what i am looking to do.
So this is the same question as in your other post (https://exiftool.org/forum/index.php?topic=14302). Please refer to that post for my response.
- Phil