Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have over 200,000 files in a folder, which I need to sequence into a movie. Quicktime Pro gives me an error so I'm trying to split up the images into various folders. Sadly, Finder is not letting me copy files to a new folder. If I go one by one, then it kind of works but each one will take a few minutes.

I'm on 10.6.8.

Any hints would be hugely appreciated for moving these files out of the folder.

share|improve this question
    
Where are those files? Aren't they on NTFS partition? –  Kamil Klimek May 17 '12 at 13:16
    
No, they are on a Mac OS Extended (Journaled) partition. It's in my documents folder. Thanks for taking the time... –  Andrew May 17 '12 at 13:34
    
It's realy strange, that you can't move them. What error do you get when you try to move/copy them? –  Kamil Klimek May 17 '12 at 13:42
    
Are these files named according to a pattern? If so, slhck here has brought you half-way home. (You can make a regex/glob-pattern based on the pattern and use that in the find command, or someone here might show you how.) –  jpaugh May 17 '12 at 13:47
1  
What I mean is, with my find, I can do something like find /folder -regex 'sameprefix[0-9]{1,3}.jpg', which would match the first 1000 files. I don't if Mac's find util is as useful though. –  jpaugh May 17 '12 at 14:23
show 3 more comments

1 Answer

You can easily move them via Terminal. First of all, list the files. This could take a while, and you can abort it by pressing CtrlC.

find /your-folder -maxdepth 1 -type f

We use maxdepth 1 to restrict results to your current directory only, not recursively going to subdirectories.

Once you're sure the output is correct, you can move them. find will do this one by one for you. Replace the folder names as needed. For example, the Movies directory in your home directory would be ~/Movies.

The following will move all files in your-folder somewhere else.

find /your-folder -maxdepth 1 -type f -exec mv '{}' /other-folder \;

Of course, you probably don't want to move all files, so you can restrict the results to certain names:

find /your-folder -iname "*.jpg" -maxdepth 1 -type f -exec mv '{}' /other-folder \;

Here, you could change *.jpg as you like. The asterisk * matches any character, and you can play with that to match only a subset of the files you want to move. You can even use a regular expression here, as @jpaugh notes:

find /your-folder -regex 'prefix[0-9]{1,3}.jpg'

This would match the first 1000 files if they're correctly named from prefix0.jpg to prefix999.jpg.

share|improve this answer
    
Thank you so much, @slhck. I will attempt this. –  Andrew May 17 '12 at 14:19
1  
Too bad that OS X's mv doesn't support the -t target argument. Otherwise find -print0 and xargs -0 would have been a time saving alternative. –  Daniel Beck May 17 '12 at 14:19
    
If people broke down the terminal this way more often, the world would be a better place. Nice! :-) –  Vishal Kotcherlakota May 17 '12 at 22:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.