+ Post New Thread
Results 1 to 7 of 7
Scripts Thread, Script to get all files and folders in a directory and save to txt file in Coding and Web Development; Hi all, I am in need of a script to produce a txt file congaing everything in a folder and ...
  1. #1

    Join Date
    Nov 2009
    Location
    somewhere
    Posts
    23
    Thank Post
    28
    Thanked 4 Times in 3 Posts
    Rep Power
    0

    Script to get all files and folders in a directory and save to txt file

    Hi all,

    I am in need of a script to produce a txt file congaing everything in a folder and all of its sub directories including all the files and folders in there e.g

    C:\
    -C:\Users\
    --C:\Users\TestUser\
    --C:\Users\Fake Account\
    ---C:\Users\TestUser\file1.txt
    ---C:\Users\TestUser\idontknow.bat
    -C:\Windows\
    -C:\Program Files\

    etc etc if u get the idea, Does anyone know of a script that could do that ?

  2. #2
    Devontechie's Avatar
    Join Date
    Nov 2007
    Location
    UK
    Posts
    889
    Thank Post
    177
    Thanked 196 Times in 160 Posts
    Rep Power
    70
    you could use the DIR command in CMD. Can't remember what switch is needed on the end but if you do DIR /? in CMD it will give you a list of switches you can use.

  3. Thanks to Devontechie from:

    timethrow (30th November 2011)

  4. #3

    Join Date
    Nov 2009
    Location
    somewhere
    Posts
    23
    Thank Post
    28
    Thanked 4 Times in 3 Posts
    Rep Power
    0
    Hi Steve,

    Thanks for the reply, However that only lists the stuff in the specific folder not in sub-directories etc. Which is what I would like to do. Thanks Anyway

  5. #4
    bmdixon's Avatar
    Join Date
    Apr 2008
    Location
    Birmingham
    Posts
    253
    Thank Post
    42
    Thanked 57 Times in 38 Posts
    Rep Power
    22
    dir /b /d /s
    should be something like that...

  6. Thanks to bmdixon from:

    timethrow (30th November 2011)

  7. #5

    Join Date
    Jun 2006
    Location
    Kendal
    Posts
    85
    Thank Post
    2
    Thanked 15 Times in 11 Posts
    Rep Power
    19
    dir /a /s >file.txt

    it isn.t pretty but it works

  8. Thanks to Finch7 from:

    timethrow (30th November 2011)

  9. #6
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    427
    Thank Post
    68
    Thanked 90 Times in 75 Posts
    Rep Power
    61
    Code:
    dir /s /a-d /b /on-s >> ./File_Listing.txt

    BoX

  10. Thanks to box_l from:

    timethrow (30th November 2011)

  11. #7

    Join Date
    Nov 2009
    Location
    somewhere
    Posts
    23
    Thank Post
    28
    Thanked 4 Times in 3 Posts
    Rep Power
    0
    Apologies to Steve and thanks to you all, That has worked beautifully

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 5
    Last Post: 1st July 2014, 08:34 AM
  2. Replies: 2
    Last Post: 2nd September 2011, 12:10 PM
  3. Replies: 2
    Last Post: 17th April 2008, 11:25 AM
  4. Script to get all file on a url
    By Midget in forum Scripts
    Replies: 5
    Last Post: 23rd January 2007, 01:10 PM
  5. Replies: 3
    Last Post: 25th September 2006, 12:27 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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