Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 5, 2013, 11:12 AM   #1
eLoup
macrumors newbie
 
Join Date: Jul 2002
image sequences in a consolidated form in Terminal OSX

Does anyone have any pointers for listing sequences as a 'consolidated' form in OSX Terminal ?

I work with Nuke (The Foundry) on osx 10.7, but this sort of question is probably one that a lot of guys working with osx or linux workstations in vfx ask, I suppose.

Example : if I have a folder named '/Volumes/mydisk/render' that has one sequence of images, five TIFF files, I would type 'ls' in the '/render' directory and get

0001.tiff
0002.tiff
0003.tiff
0004.tiff
0005.tiff

but what I want to see is something like this :

0001-0005.tiff or [1-5].tiff

in the same way that I want to SEE files listed as so, I would also want to be able to delete 'rm', copy 'cp', or move 'mv', using the same sequence command.

Example : “copy frame ranges from one directory to another”

cp /Volumes/mydisk/render/[2-4].tiff /Volumes/disk2/folder

which would copy images 0002.tiff, 0003.tiff, 0004.tiff over to my example folder “/Volumes/disk2/folder/ “

I think most of us understand why this is desirable, but I'm not finding anything on the intenet that's pointing me to any solutions....

anyone ?

When you have a single folder containing upwards of 50,000 images or more (tiff, dpx, exr etc) and you type 'ls' the Terminal leaves a lot to be desired... At the same time, opening a Finder window is always panic inducing, especially if you have to drag and drop a selection from one Finder window to another. It's fine if you've got, say 1000 images in your folder. But anything more and it can really become ball busting.

Thanks to anyone who may point me to the right direction !
eLoup is offline   0 Reply With Quote
Old Feb 5, 2013, 11:54 AM   #2
ScoobyMcDoo
macrumors 65816
 
Join Date: Nov 2007
Location: Austin, TX
For copying and other file manipulation, you should be able to use regular expressions. For example "cp 000[1-4].tiff dest_dir/" Go read about regular expressions to find out how to create more sophisticated expressions.

As far as listing your files. You could probably pipe ls through and awk script (or whatever scripting language you prefer) to get the output you want. I know of no built-in command which would list the files as you desire.
ScoobyMcDoo is offline   0 Reply With Quote
Old Feb 6, 2013, 05:01 AM   #3
eLoup
Thread Starter
macrumors newbie
 
Join Date: Jul 2002
Thanks ScoobyMcDoo for the suggestion, but your expression isn't working for me. I'm trying all sorts of things but the best I seem to be able to do is copy one, or two files - It seems impossible to specify a range ... ? Any help ? I am a very basic Terminal user and have no unix/linux experience, so it goes without saying that I have no idea what an awk script is. I started trying things like cp [00013 n+1 00018].jpg /destinationfolder

hoping in some naive way that there was a way to "increment by n+1" from one number (00013) to another (00018)... of course this doesn't work....

anyone have any ideas ?
eLoup is offline   0 Reply With Quote
Old Feb 6, 2013, 10:19 AM   #4
ScoobyMcDoo
macrumors 65816
 
Join Date: Nov 2007
Location: Austin, TX
I recommend you google the term "regular expression". You will find multiple tutorials on learning how to use them. Trying to guess at how regular expressions work will be about a fun and productive as rubbing a cheese grater on your head - RTFM.
ScoobyMcDoo is offline   0 Reply With Quote
Old Feb 6, 2013, 12:08 PM   #5
mfram
macrumors 6502a
 
Join Date: Jan 2010
Location: San Diego, CA USA
Quote:
Originally Posted by ScoobyMcDoo View Post
For copying and other file manipulation, you should be able to use regular expressions. For example "cp 000[1-4].tiff dest_dir/" Go read about regular expressions to find out how to create more sophisticated expressions.
No this is not correct. The shell does not use regular expressions. It uses something called "globbing". They are not the same.

As for the original question, you can't get a numerical sequence out of globbing. If you want a purely numerical sequence then you will have to write a script (in some language of your choice) to perform the operations.

If you want to see what you can do in the shell, then "man bash". Look for the section on 'Pathname Expansion'.

The expansion choices are *, ?, {}, and []. * matches all characters (including none). ? matches exactly one character. {} matches a list of characters, and [] matches a range of single characters.

005{1,2,7} would match "0051 0052 0057"

005[0-2] would match "0050 0051 0052"

If you want files 54 to 71, you'd need an expression like

005[4-9] 006% 007{0,1}
mfram is offline   0 Reply With Quote
Old Feb 6, 2013, 01:18 PM   #6
ScoobyMcDoo
macrumors 65816
 
Join Date: Nov 2007
Location: Austin, TX
Quote:
Originally Posted by mfram View Post
No this is not correct. The shell does not use regular expressions. It uses something called "globbing". They are not the same.
Sorry for the brain fart -- I knew that. mfram, thanks for the correction.
ScoobyMcDoo is offline   0 Reply With Quote
Old Feb 6, 2013, 03:01 PM   #7
mw360
macrumors 6502a
 
Join Date: Aug 2010
You might want to try writing a Python script to do this. Somebody's trying to do something similar (but not quite the same) here, and gets what looks like a working solution.

You might think learning to make Python scripts sounds like overkill but knowing a bit of Python can vastly improve your Nuke experience.
mw360 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Well this is interesting! OSX is using an iOS image tlink91 OS X Mavericks (10.9) 7 Nov 8, 2013 04:35 PM
Random sequences generator Bond J. Mac Applications and Mac App Store 1 Sep 2, 2013 02:06 PM
Changing secondary monitor background image in Terminal jsimons Mac Programming 1 Aug 1, 2013 06:22 PM
Organising photos into sequences? (wakeboarding) alexjholland Digital Photography 7 Jul 29, 2013 08:04 PM
Adding terminal command on start-up, Lion OSX Vegbrain Mac Applications and Mac App Store 18 Mar 19, 2013 02:33 AM

Forum Jump

All times are GMT -5. The time now is 03:44 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC