How to create a view of files contained across multiple directories


  1. Posts : 5
    Windows 10
       #1

    How to create a view of files contained across multiple directories


    Windows 10:

    The Objective: Create a virtual directory of files contained in multiple directories, essentially a view. The list of files in the virtual directory should have the file attributes available as well.

    DIR1
    FileA1
    FileA2
    FileB1

    DIR2
    FileA3
    FileA4
    FileB2

    ----> Library
    FileA1
    FileA2
    FileA3
    FileA4

    So create links or shortcuts containing a compilation of all files with name FileA* along with file attributes (size, creation date, etc.) and store them in a library folder. (Double-clicking the links should open the file to which they point.)

    I tried doing a file search for FileA* across all directories and then creating shortcuts on the resulting set of files. My limited knowledge of Windows - it seemed that the only place I could save the group of shortcuts was to the desktop which I could then cut and paste to a library folder. However, this does not yield the attributes of the files to which they point.

    It seems this should be easy to do?

    Thanks for any creative ideas
      My Computer


  2. Posts : 456
    Windows 10
       #2

    Have you tried something using the command line utility robocopy. Something like:

    robocopy source destiny /e /create

    + you can include options to include \ exclude files and folders...

    A couple of years ago I also created a script that I call SSC (Shortcut Structure Creater) that you can check out on this post:

    Creating a copy of a folder that is populated with shortcuts.

    Why don't you just add the files you want to a library?
      My Computer


  3. Posts : 5
    Windows 10
    Thread Starter
       #3

    Thanks, Ricardo...

    I maybe didn't make it clear. The files must remain in their original directories. I don't wish to make copies since that would double the space used. So I was hoping for like a shortcut but that would have the file properties too.

    I think I found something that might work - symbolic links.

    I tried creating a soft link but the file properties were not there. So then I tried a hard link and that seemed to work. It creates a virtual copy of the file along with file properties but without taking up any space. And if I double-click the link, the file is opened according to the file extension just as the physical file would.

    So one needs to start a shell as admin with the command

    mklink /h linkname filename

    Now the trick becomes to write a script that will collect the filenames and pass them as arguments to the command that will complete the specific link name for each file.
      My Computer


  4. Posts : 456
    Windows 10
       #4

    Would the reason you don't want to use libraries be the large amount of files that you would have to manually select?
      My Computer


  5. Posts : 989
    Microsoft Windows 10 Home
       #5

    1. Create a Library that includes Dir1 and Dir2
    2. Execute a search for name:FileA*
    3. From the Search tab, select Save Search and name it FileA LIbrary (or whatever you want)
    4. Create a shortcut to the saved Search and place it on the Desktop​ or wherever you want.
      My Computer


  6. Posts : 5
    Windows 10
    Thread Starter
       #6

    Probably because I just realized that I don't know how libraries work. I know I can create a new library. But you can't add anything to it like a file. You can only add folders. So great - easy to add a folder but then you get all of the files in that folder. I only want some of the files that exist across multiple directories. And the files in the library need to have the properties available. A symbolic hard link seems to do the trick.

    So automation will provide for any number of directories and files and will allow for dynamic library creation if the source changes (i.e., files are added, modified or deleted) without manual effort.
      My Computer


  7. Posts : 989
    Microsoft Windows 10 Home
       #7

    Tom Swift said:
    Probably because I just realized that I don't know how libraries work. I know I can create a new library. But you can't add anything to it like a file. You can only add folders. So great - easy to add a folder but then you get all of the files in that folder. I only want some of the files that exist across multiple directories. And the files in the library need to have the properties available. A symbolic hard link seems to do the trick.

    So automation will provide for any number of directories and files and will allow for dynamic library creation if the source changes (i.e., files are added, modified or deleted) without manual effort.
    Seems like a lot of unnecessary work. Did you not undertand my reply? I can add screenshots if that helps.
      My Computer


  8. Posts : 1,771
    Windows 10 Pro
       #8

    KeithM said:
    Seems like a lot of unnecessary work. Did you not undertand my reply? I can add screenshots if that helps.
    I just joined this thread, but I'm interested in learning about Libraries so please do post some screenshots.
      My Computers


  9. Posts : 5
    Windows 10
    Thread Starter
       #9

    Hi Keith,

    I did get your post. Thanks.

    I wanted to test it out to see how it worked before responding. So conceptionally, it works as advertised.

    1) I added 2 directories to a library
    2) Did a search for file pattern
    3) Saved the search
    4) Created shortcut

    And when I double-click the saved shortcut, I get the file list with attributes. And I can double-click an entry in the list to open it.

    I didn't realize you could save a search so I learned another tip.

    So I thought, why add the directories to a library? I did a search from the parent directory of DIR1 and DIR2 which resulted in the file list but along with the names DIR1 and DIR2. I just wanted the file names. So I had to figure out how to exclude the directory names if I wanted to use this approach. I found this:

    In the search box:

    name:FileA* NOT(kind:folder)

    which eliminates the directory names from the result.

    Although there may have been an easier way to tweak the search, I have learned more about Windows than I ever wanted to. (Give me a command line anytime).

    Ok. So back to the problem. Suppose there are 50 or 100 DIRs to be included in the library? I tried to add a group of selected DIRs but there was no option to add multiple DIRs to a library. The option to add appears when I select just a single DIR. Now what happens when a new DIR is created? I must remember to add it to the library each time as well.

    I also tested deleting and adding files to the source DIRs. Running the shortcut to the saved search displayed the updated results.

    So your approach works, Keith. Thanks!

    The advantage of a script allows for dynamic creation of the file list regardless of the number of directories (and also avoids the idiosyncrasies of Windows).
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:55.
Find Us




Windows 10 Forums