AutoHotkey Community

It is currently May 27th, 2012, 11:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: January 6th, 2012, 7:23 am 
Offline

Joined: January 21st, 2009, 5:49 pm
Posts: 176
Anyone know how to get an Absolute Path from Relative?

I have a small recursive copy utility that copies files matching Pattern to a target directory. I'm stuck trying to figure out how to get the absolute path if the user puts a relative path on the command line.

I want to be able to catch if the target folder is a potential source folder as the recursion progresses and notify the user etc..

Also it would be generally useful to have an AbsoluteFromRelative() function.

Here's the simple loop

Code:
Loop, %FilePat%,,1
{
   FileCopy, %A_LoopFileLongPath%, %DestFold%, %OverWrite%
   if !ErrorLevel
      CopyCount += 1
}

_________________
"I don't want to belong to any club that would have me as a member."
- Groucho Marx


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 4:20 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Have you tried the AbsolutePath function?

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 8:21 pm 
Offline

Joined: January 21st, 2009, 5:49 pm
Posts: 176
sinkfaze wrote:
Have you tried the AbsolutePath function?


That's it exactly. Thanks :)

edit: this person thinks like I do. Leverage existing functionality. Handles both folders and file paths. Main differences: For folders it returns with the trailing slash; can do file path as well as folder path(which is probably why it retains the slash);

http://www.autohotkey.com/forum/viewtopic.php?t=43623

Thanks for the link as it led to several approaches. :)

_________________
"I don't want to belong to any club that would have me as a member."
- Groucho Marx


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Edd, Exabot [Bot], Google Feedfetcher, HotkeyStick and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group