Welcome Guest.   Make a donation to an author on the site April 23, 2014, 11:31:52 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the Practical Guide to DonationCoder.com Forum Search Features
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA - Extract folder and file paths from specified folders  (Read 3340 times)
TalksToPCs
Supporting Member
**
Posts: 20

View Profile Give some DonationCredits to this forum member
« on: August 31, 2009, 02:04:06 PM »

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:36 PM by TalksToPCs » Logged
skwire
Moderator
*****
Posts: 3,911



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: August 31, 2009, 05:28:28 PM »

Would you like a GUI or is a single-run type of script sufficient?
« Last Edit: August 31, 2009, 07:02:38 PM by skwire » Logged

skwire
Moderator
*****
Posts: 3,911



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: August 31, 2009, 06:59:04 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.dcmembers.c...th_parser/Path_Parser.zip



Logged

TalksToPCs
Supporting Member
**
Posts: 20

View Profile Give some DonationCredits to this forum member
« Reply #3 on: September 01, 2009, 02:13:32 AM »

Thank you! It works great!  cheesy 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.
Logged
skwire
Moderator
*****
Posts: 3,911



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: September 01, 2009, 02:18:29 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?
Logged

TalksToPCs
Supporting Member
**
Posts: 20

View Profile Give some DonationCredits to this forum member
« Reply #5 on: September 01, 2009, 03:16:57 AM »

Correct
Logged
skwire
Moderator
*****
Posts: 3,911



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #6 on: September 01, 2009, 03:22:25 AM »

Re-download and see if the latest changes follow your requirements.

http://skwire.dcmembers.c...th_parser/Path_Parser.zip
Logged

TalksToPCs
Supporting Member
**
Posts: 20

View Profile Give some DonationCredits to this forum member
« Reply #7 on: September 01, 2009, 03:52:06 AM »

Perfect! Thanks.
Logged
skwire
Moderator
*****
Posts: 3,911



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: September 01, 2009, 04:01:03 AM »

You're welcome.  Glad I could help out.
Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.032s | Server load: 0.1 ]