Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 lot of files (100s of gb) and I want to give some of them to my friend. But he must select, which files he needs and I can't give him all files at once (I have no such big usb flash or usb hdd). I can make a list of all files and transfer them on small usb flash to him, and then he can say, which folders he want and which not.

How should I make the list of files, which can be easily viewed in standard windows xp install or with some small WindowsExplorer-like program? I can do an ls -lR-like listing and store it in txt, but it will be hard to my friend to view this list. There is a diskdir plugin of Total Commander, which can archive folder into text file with only names and paths of files stored. Then this plugin allow total commander to move inside this archive like inside the zip or arj. But I think, total commander is to difficult to use to my friend, so I'm asking about Windows Explorer-like solution (e.g. winzip allows Explorer to move inside zip archives, and I want something like).

So. I can install any program, also I can store viewer program with file list on usb flash.

share|improve this question
It sounds like what you're wanting is a duplicate of the file structure, but instead of the actual date in the files, just have the file names as dummy files so your friend can navigate the structure to tell you what he wants, is that a correct understanding of the request? – Matrix Mole Jul 27 '11 at 0:02
yes, you are right, Matrix – osgx Jul 27 '11 at 19:10
if you have access to powershell, I can toss together a script to do this for you – Matrix Mole Jul 27 '11 at 20:34
I have access to bash (windows version). What can be an main idea? There is no powershell on my friend's computer. – osgx Jul 27 '11 at 20:42
was considering a script that could recreate the directory structure just as you were asking, powershell wouldn't need to be on friends PC since the directory structure would be merely directories and empty text files with file names. – Matrix Mole Jul 27 '11 at 21:02
up vote 1 down vote accepted

Assuming you can get powershell v2 installed on your local machine (or already have it installed) the following script can do what you're after (it might work in powershell v1, not certain):

$dupedir = "D:\Backup"
$newdir = "C:\Temp"
$dupelist = Get-ChildItem -Force -Recurse -ErrorAction SilentlyContinue $dupedir

foreach ($item in $dupelist) 
    If ($item -is [Io.DirectoryInfo])
        $itemtype = "directory"
    If ($item -is [Io.FileInfo])
        $itemtype = "file"

    New-Item -Force -type $itemtype -Path $item.FullName.Replace("$dupedir","$newdir")

Change the path for $dupedir to the root of the path you want to let your friend know about. Once this script finishes running, you should have an exact mirror of the filestructure (but not actual files) you want to let your friend look over in C:\Temp (or somewhere else if you change the directory for the $newdir variable as well. Don't have the $newdir variable be inside the directory of the $dupedir variable or you will get infinite recursion which could eventually consume all disk space (even if the "files" are 0 byte files).

Nice thing about powershell is that you can "write" scripts at the commandline (similar to bash). Copy the code into a text editor, make the path changes, then copy and past the whole thing into your powershell window and it'll do it's magic.

I know you mentioned you have bash, and if you wanted this on a unix/linux machine I might have been able to do it in bash. Unfortunately I was never very good with bash scripting when it required monkeying around with the windows filesystem.

share|improve this answer
Not for powershell, but for idea of recreating all files with same paths and names but 0 sized. – osgx Aug 5 '11 at 18:05

Just use the dir /s > C:\temp\filename.txt command. This will output the directory structure to the file C:\temp\filename.txt. Start in the location you want to go down from.

Then just send him the TXT file.

share|improve this answer
The txt is hard to navigate. – osgx Jul 27 '11 at 19:10
In what way is it hard to navigate? Maybe try "dir /s /b > C:\temp\filename.txt". (adding the /b to strip out most of the extras. – KCotreau Jul 27 '11 at 19:24
The list is 4 megabyte long. But the files are organized in folders, in several layers. I want to show to my friend the folders, but he can be interested in some folders content (see subfolders, subsubfolders and names of files inside some subfolders). – osgx Jul 27 '11 at 20:41
I ran that command from the root of the C-drive. I suggest you run it from only the location(s) in question, like where your "My Documents" is located, for example. If you add /ad to the command, it will give you only directories. There is no easy way to pick only the files you want off a drive with one command. You may have to run several from different locations, maybe with different switches depending on what you want. – KCotreau Jul 27 '11 at 20:51
I think, the matrix's "directory structure would be merely directories and empty text files with file names." will be better – osgx Jul 27 '11 at 21:13

Why not use a zip file? You can view all the files in one window, yet have them extract to different folders.

share|improve this answer
I cant send all files even in paked form, they are too big. I want only to send file names in tree-like manner. – osgx Jul 27 '11 at 19:11
Can I create a zip with all directories, and files, but without file content (0-byte files in the zip) – osgx Jul 27 '11 at 21:14

I thought about this question some time now and I came across two solutions. The best one is the following.

Use cdcat which is a program that can index filesystem trees like DVDs or hard drives (without storing big files to the index) and store multiple of them in one catalog. This is probably the program of choice for such a task because it will also include meta information of music (ID3 tags) and videos (resolution, duration and so on) to the catalog. Another nice feature is that cdcat can calculate how big an indexed directory or a file (node) is.

It will save all the meta information (and small files like nfo if you configure it to do this) in a compressed XML file. To copy files from you (person A) to someone (person B), after allowing him (B) to select what he actually wants, could work like this:

  1. Person A indexes all of his interesting files (you should check the settings of cdcat before doing so to be sure what is going to be included like nfo, ID3 tags, …) and saves them as one catalog.
  2. Person A copies the catalog over to person B.
  3. Now person B has to select the files somehow. I came up with the idea of using the category field which can be added to each node (directory or file). This field could be used as a priority for example. Any node which has no category recursively attached to it or with a special category will not be copied later. The category is also saved to the XML file and it is not very hard to write a parser for this to export for example a .bat script or Bash script to copy all of the wanted files.
  4. Person B gives the OS specific copy script to person A (or of course person B gives the modified catalog back and lets person A generate the copy script).
  5. Person A executes the copy script and gives person B the data medium. (There will be one little inconvenience because cdcat does not save the path to the mount point from where the data was indexed to the catalog.)
  6. Person B copies the files to his storage and hands the data medium back to person A.

This solutions is not yet perfect but it is the best I came up with. I have not used this yet but I will do so in the future. During this I will need to write some extension or script which generates copy scripts for Linux and for Windows. My plan is to include this directly to the cdcat program.

A second and more sophisticated solution which is worth mentoring is to use git-annex which can probably also be used for this, but I did not think about this as careful as about the solution with cdcat because this second approach would somehow require that both persons (A and B) have git-annex and know how to use it …

I will keep you up to date.

share|improve this answer
I now wrote a parser script in Python to generate copy scripts. I did not yet test it but the difficult things should already be handled and it should be easily expendable. The only copy script format which can currently be generated is based on git-annex. I plan to use git-annex even if the person I exchange data with does not use it because then I know exactly which files I gave him and thous files I can get from him back if my hard drive fails. The script is located on GitHub. – ypid Feb 21 '14 at 17:09
Started working on robocopy support. Link to the script changed:… – ypid Mar 20 '14 at 21:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .