Project Description

A command line utility to see if one or more files (given a filemask) are to be found anywhere inside a specific directory, or elsewhere inside one of its subdirectories. A sort of poor man's synchronisation utility, very simple but maybe quite handy.

Problem

A collection of documents
When I begin working on a project, I frequently search for documentation on one of its particular topics, or I write some notes in various text files and I eventually download tons of pdf and doc files. I may do this on my workstation, on my laptop, or even on a customer machine while we discuss on the project.

A central repository
I always have a central, quite well organized, directory for each project, residing on my workstation, usually containing subdirectories for the various file types I gather here and there, or for the notes or other documents I write on some specific topics, ideas, etc...

Disconnected mobility
Having always an usb key in my pocket I take some of these files with me, typically the ones I'm going to read at home, and I put them on my laptop. Then I download other files on my laptop, and so on, wherever I am or whatever workstation I'm working on.

Bring'em back
So, to make a long story short, all these files travel with me. I usually put them in a messy directory on one of my usb keys, just the first one I can grab in my hand. Then, when I'm back on my workstation, of course I don't know anymore if all of the files in my usb key directory are already present in my well organized project directory.
That's what this small utility helps to answer to. What I'm asking it for is for example: "are all of the pdf files of this directory (on my usb key), already saved in my project directory ?".

Solution

The answer
So for each file matching the input filemask, the utility searches the target directory recursively to find the file. If it's found, it outputs nothing (or a comment beginning with "rem ", if verbose mode on), and if not found, it output an xcopy statement that should copy the file into the root of the target directory.
This way, the output of the utility can be redirected in a one shot batch file that can be run after its own execution.

Conclusion
Although there's nothing revolutionary under the hood (seems more like a big procedural code snippet...), it may be nonetheless worth - or at least, let's say, humm, refreshing! - to take a look at this VB.NET code or, why not, use the utility "as is".

Usage
Sample 1:
C:\> isanywhere . mydocument.txt h:\usbkey\mymess

Sample 2:
C:\> isanywhere C:\temp *.pdf h:\usbkey\mymess /copy /v

Last edited Jan 27, 2008 at 10:56 PM by francescofresco, version 6