Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder containing a lot of pictures and a program to update some of the pictures.

I want to make a new folder with copy of the old picture and run the program on them but I want to save space on my hdd so I don't want to have a copy of all the unchanged pictures.

share|improve this question
It'd be nice to know what program it is, or at least what it does. – digitxp Jan 18 '11 at 13:33
up vote 2 down vote accepted

Does the program simply write over the modified picture, or create a new file and remove the old? If the latter, you can make your working directory with cp -dRl origdir workdir, which will create hard links instead of new copies. (Or cp -dRs if you'd prefer to use symbolic instead of hard links.)

share|improve this answer
Hardlinks are the way to go, I currently use them with my remote backups, I have about 400 GB of daily backups stored in <10 GB of actual HDD space. – Hydaral Mar 9 '11 at 6:51

I'd make use of /tmp and make a shell script to copy each picture there then process it. If the picture is successfully processed, move it elsewhere, if not, delete it. Do this one picture at a time.



for f in *
     cp "$f" /tmp
     /path/to/yourprogram "/tmp/$f"
     # check if picture was processed correctly, possibly via exit code ($?)
     if [ $? -eq 0 ]
           mv "/tmp/$f" /some/other/location
           rm "/tmp/$f"

Many ways to skin a cat, modify according to your needs.

share|improve this answer
Looking around, I can't find any documented exit codes for ImageMagick. This sets grim expectations for this program which has yet to be named. – digitxp Jan 18 '11 at 13:47

Your Answer


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.