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.

Okay, well I've uploaded 5 gigs of images to Dropbox, and those are directly off the camera.

In another country, my friend with rubbish internet (whom retrieved a CD containing the images) copied the images to a folder on his desktop and began sorting out the images; that is- deleting bad/unneeded images. I can't ask him to upload 5gigs to MY personal dropbox account, when it took me a week to upload with my faster internet.

Is there a piece of software that I can run on his Windows 8 PC to take a list of filenames (directory recursive, since I gave it to him sorted in individual folders for each event); which when then run again on my Snow Leopard MacBook would be able to see which images were deleted on my friend's computer; and then delete them on my side.

If such a program doesn't exist, what framework can I use to programme this (I'm developing on a Mac)? And what tips would you give me?

share|improve this question
Is he reorganizing the images (so they change folders), or just deleting some? –  cpast Feb 17 '13 at 23:36
just deleting some –  qaisjp Feb 18 '13 at 0:09
Not really, since the OSes use different shells. If both ran Windows I'd simply run dir /b /a-d > output.txt on both PCs and then use a text diffing utility to get the list of differences. As it is, you can probably still run that on his PC, then run the equivalent ls command or whatever on your mac, but the output format will be different. Maybe use Perl or something to read both files into two hashes and compare the hashes, then output the difference? –  Mark Allen Feb 18 '13 at 0:35
@MarkAllen - There could be a way involving dir /b/s > files on Windows, and some awk/sed->xargs command on Mac. –  cpast Feb 18 '13 at 1:42
I could always write a program to do this, but –  qaisjp Feb 18 '13 at 2:20

2 Answers 2

up vote 1 down vote accepted

This answer borrows liberally from a couple of the comments.  Have your friend run

dir /b/s/a-d > dir.out

You run

find . -print > find.out

Normalize dir.out and find.out:

  • Make the line endings uniform (e.g., NL or CRLF),
  • Remove common prefixes (C:\Users\… and ./),
  • Change backslashes (\) to slashes (/) in dir.out, and
  • Sort both files.

Now do

comm dir.out find.out

(You may want to pipe that into a pager such as more or less.)  The output will consist of three columns:

  1. Entries (filenames) present only in the first file (dir.out).  There shouldn’t be any; if there are, your friend included a file that he didn’t get from you, or else you didn’t completely normalize the files.  (OK, depending on exactly how your friend did his dir command, the dir.out file itself might show up in column 1.)
  2. Entries present only in the second file (find.out).  These are the names of the files that you have on your system but your friend didn’t list.  In other words, these are the files you want to delete.
  3. Entries present in both files.  This should be the same as dir.out.

If there are false negatives because of case mismatches (‘A’ ≠ ‘a’), try the comm command again with a -f option.  You’ll probably to repeat the sort with a -f option, too.

Now, type comm -13 dir.out find.out.  This incredibly brain-damaged syntax means “give me all the normal output except for columns 1 and 3,” in other words, output column 2 only.  As indicated above, this is the list of files you want to delete, so pipe it into xargs rm or something like that.

I’m assuming that you don’t have any wild and crazy characters (such as space, quotes, ‘*’, ‘?’, ‘<’, ‘|’, etc.) in your filenames.  (This shouldn’t be a problem; cameras tend to use filenames like “DSCN1234.JPG”.)

share|improve this answer
In "Make the line endings uniform (e.g., NL or CRLF)," do you mean LF or CRLF? –  qaisjp Feb 24 '13 at 13:28
Can you help me out in the xargs, though? I've output the files I need to delete to a todelete.out –  qaisjp Feb 24 '13 at 13:51
Figured it out: xargs rm < todelete.out I made sure to escape the spaces in the filename list (TextWrangler find and replace " " with "\ ") so that it works properly. –  qaisjp Feb 24 '13 at 14:07
@qaisjp: If you look up the byte value 10 (decimal) (equivalently, 012 octal or 0x0A hex) in most ASCII tables, you will see it identified as Line Feed (LF). When sent to a mechanical, character-oriented printer (like a teletype), it typically causes the paper to be advanced one line without moving the print head. When sent to a video terminal, it typically causes the cursor to move down (or the screen contents to scroll up) without moving the cursor horizontally. (continued) –  Scott Feb 26 '13 at 1:04
@qaisjp: Most non-Unix operating systems in use today use a Carriage Return (CR) together with a LF at the ends of lines (EOL). The creators of Unix decided that this CRLF functionality was common enough that it should be encoded in a single byte, and that the LF functionality was rarely used, and so they ‘invented’ the concept of a newline character which performed the end-of-line CRLF functionality, and was encoded with a byte value of 10. See en.wikipedia.org/wiki/Newline, and unicode.org/charts/PDF/U0000.pdf (which shows that 10 is both LF and NL). (continued) –  Scott Feb 26 '13 at 1:04

You could pull that off with GoodSync Connect (not affiliated). It costs to use this feature, but there is a 30-day trial during which it works in the free version.

  1. You install GoodSync on both sides (there are Mac, Windows and Linux versions).
  2. You set up GoodSync Connect which establishes a direct-ish link where info about the directories are transferred via mediator, though not the files themselves.
  3. On your side, you set up a Sync job.
  4. Select the Dropbox folder with the pictures.
  5. Your friend copies the files from the DVD to a directory. Select this folder through GoodSync Connect.
  6. You select the Analyze option in the sync job. GS now establishes that both folders are the same. This creates a reference comparison file on both sides. (Important!)
  7. Then your friend deletes the pictures he does not want. (Or, if he has already done so, he deletes the content of the folder where he stored all pictures - except for the _gsdata folder. He puts the modified folders there.)
  8. Perform analyze, which will show you a preview.
  9. If your OK, sync. GoodSync will do its magic.


  • GoodSync will detect file and folder moves and renames and should work without a hiccup. So it will not attempt to move files. (Unless the file contents have been modified. But that's why you analyse first!)
  • GoodSync will delete those files your friend has deleted. They'll be in the Recycle bin.
  • Oh, and do make a backup before this. Yes, seriously. Or try it locally.
  • And if you don't trust your friend, disable the GoodSync Connect server after you're done. Otherwise your friend will see all your files. (There is probably a way around this, but I haven't found it yet.)
share|improve this answer

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.