Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2015
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Macro to read filenames from a folder and create delimiter text file

    Hi All

    Can you anyone of you help me in creating macro to read all filenames from a folder and create text file(delimiter). We will have 2.5million files in that folder. I tried one macro to read all filesname into excel then save as to csv but it is talking too much to complete reading files
    My text file format should be

    File Name path,FileName,File extension

    thanks

  2. #2
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    3,188
    Thanks
    152
    Thanked 591 Times in 561 Posts
    Hi

    ..you could use a command-line prompt to 'pipe' the file listing of a folder contents directly to a csv file.
    I normally limit folders to 1,000 files each, and use multiple sub-folders, e.g 1000 subfolders each with 1000 files gives 1 million files.

    zeddy

  3. #3
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,790
    Thanks
    139
    Thanked 705 Times in 639 Posts
    Srinumujgi,

    See if this non-macro old IT tip does instantly what you want:

    1. Open Windows Explorer and while holding the shift key, right click the folder you want to copy.
    2. Select Open command window here from the context menu. A CMD window will open

    folder5.png

    3. Type the following after the prompt: dir > filelist.txt (Note the spaces " > ". Replace filelist with any name you choose with the extension.txt)
    TXTFolder2.png
    The text file will be created in the same folder as the files.

    HTH,
    Maud
    Last edited by Maudibe; 2015-08-11 at 05:45.

  4. #4
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,689
    Thanks
    59
    Thanked 1,065 Times in 990 Posts
    You need to type this in the Command Prompt Window:
    for /f %I in ('dir /b /a-d') do echo %~dI%~pI,%~nI,%~xI >>%tmp%\DirList.csv

    To open the file type this in the Command Prompt window:
    start "" %tmp%\DirList.csv

    Note: the list will include a dot before the extension.

    cheers, Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •