topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 5:18 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA - Extract folder and file paths from specified folders  (Read 9177 times)

TalksToPCs

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 21
    • View Profile
    • Donate to Member
Dear Coders,

I'm a non-programmer with only basic scripting skills.

I want to mass-extract file names from a folder and write them to a text file. The "\" in the path should be converted to "<". An AutoHotkey script would be great because there is a chance that I might be able to modify it.

Steps:
1. Select folder from a menu
2. Extract folder paths and convert them to my desired format:
P:\Z_Systems\Favoriten yields the following:
P:<Z_Systems<Favoriten<folder 1\folder 1
P:<Z_Systems<Favoriten<some other folder\some other folder
Mind that there should be a backslash after the actual folder name followed by the last folder name.
It should issue a warning should one of the paths have more than 127 characters. I will put in that warning by myself later.
...
3. Write these files to a text file that is saved on the desktop.
... That's it.

It would be kind of nifty if I would be able to select between files and folders at the beginning (either one or the other should be extracted, but not both).
P:<Z_Systems<Favoriten<file 1.doc\file 1.doc

Thank you so much!
« Last Edit: August 31, 2009, 02:08 PM by TalksToPCs »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #1 on: August 31, 2009, 05:28 PM »
Would you like a GUI or is a single-run type of script sufficient?
« Last Edit: August 31, 2009, 07:02 PM by skwire »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #2 on: August 31, 2009, 06:59 PM »
Here you go.  Select a folder, choose the desired radio button and click Go.  When it's done scanning the folder, it will prompt you for a filename to save to.  Two files will then be saved, one as your chosen name and the other with a "_long" addition.  That second file will contain the paths that are longer than 127 characters.  For instance, if you chose test.txt as your filename to save to, you would get a test.txt and a test_long.txt.

Download (source/binary included): http://skwire.dcmemb...rser/Path_Parser.zip

main.pngIDEA - Extract folder and file paths from specified folders


TalksToPCs

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 21
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #3 on: September 01, 2009, 02:13 AM »
Thank you! It works great!  :D Check's in the mail...

I almost dare not ask but the underscores and file name extensions create some problems for me. (Sorry for not pointing out that earlier.)

Specifically,
P:\Z_Systems\Favoriten\file_1.doc

should turn into
P:<Z_Systems<Favoriten<file_1.doc\file 1

It would save me from having to use the find and replace function.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #4 on: September 01, 2009, 02:18 AM »
So, to clarify:

1) When we add the filename or foldername to the end of the path, change any underscores to spaces.
2) Whilst in files mode, strip the extension.

Correct?

TalksToPCs

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 21
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #5 on: September 01, 2009, 03:16 AM »
Correct

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #6 on: September 01, 2009, 03:22 AM »
Re-download and see if the latest changes follow your requirements.

http://skwire.dcmemb...rser/Path_Parser.zip

TalksToPCs

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 21
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #7 on: September 01, 2009, 03:52 AM »
Perfect! Thanks.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA - Extract folder and file paths from specified folders
« Reply #8 on: September 01, 2009, 04:01 AM »
You're welcome.  Glad I could help out.