1. walk_dir() and full path
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Sep 18, 2006
- 523 views
Is there a way to retrieve the full path for a file name supplied by walk_dir()? JG
2. Re: walk_dir() and full path
- Posted by "Greg Haberek" <ghaberek at gmail.com> Sep 18, 2006
- 514 views
> Is there a way to retrieve the full path for a file name supplied by > walk_dir()? Your function provides 2 parameters: 'path' and 'entry'. 'path' is the current path, 'entry' is a dir entry (ths I'm sure you already know, just establishing the facts). Take the D_NAME part of entry and append it to path, you should have the full path.
function your_func( sequence path, sequence entry ) sequence full_path full_path = path &'\\' & entry[D_NAME] return 0 -- keep going end function
~Greg
3. Re: walk_dir() and full path
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Sep 18, 2006
- 538 views
- Last edited Sep 19, 2006
Greg Haberek wrote: > > > Is there a way to retrieve the full path for a file name supplied by > > walk_dir()? > > Your function provides 2 parameters: 'path' and 'entry'. 'path' is the > current path, 'entry' is a dir entry (ths I'm sure you already know, > just establishing the facts). Take the D_NAME part of entry and append > it to path, you should have the full path. > > }}} <eucode> > function your_func( sequence path, sequence entry ) > > sequence full_path > > full_path = path &'\\' & entry[D_NAME] > > return 0 -- keep going > end function > </eucode> {{{ > > ~Greg > > I know the path but the program doesn't. Starting from a directory, c:\my_root_path\, I am trying to walk down a very deep directory tree, reading any files under sub-directories, modifying these files, and writing them again with the same tree-path but under different root directory: instead of c:\my_root_path\the-directory-walked-throuh I want to write them to c:\another_root_path\the-same-sub-directory-that-was-walked-through. The problem is that walk_dir() does not supply information about sub-directories it is walking through. JG
4. Re: walk_dir() and full path
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 18, 2006
- 541 views
- Last edited Sep 19, 2006
Julio C. Galaret Viera wrote: > > > Is there a way to retrieve the full path for a file name supplied by > > > walk_dir()? > > Starting from a directory, c:\my_root_path\, I am trying to walk down a very > deep directory tree, reading any files under sub-directories, modifying these > files, and writing them again with the same tree-path but under different root > directory: instead of c:\my_root_path\the-directory-walked-throuh I want to > write them to > c:\another_root_path\the-same-sub-directory-that-was-walked-through. > > The problem is that walk_dir() does not supply information about > sub-directories > it is walking through. What does this example program show you? Is it what you wanted?
include file.e function action(sequence pPath, sequence pDir) sequence lToDir integer lPos if find('d', pDir[D_ATTRIBUTES]) = 0 then lPos = find('\\', pPath[4..$]) if lPos then lPos += 4 else lPos = length(pPath) end if lToDir = pPath[1..3] & "NEWLOC\\" & pPath[lPos..$] printf(1, "Copying %s\\%s to %s\\%s\n", {pPath, pDir[D_NAME], lToDir, pDir[D_NAME]}) end if return 0 end function object VOID VOID = walk_dir("C:\\EUPHORIA", routine_id("action"), 1)
-- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
5. Re: walk_dir() and full path
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Sep 19, 2006
- 509 views
Yes, that is what I want to do. Thanks Derek and Greg. JG