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 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.

Any ideas?

I am running Debian.

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
add comment

2 Answers

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
add comment

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.

e.g.

#!/bin/bash

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

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
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.