RE: Current Directory
- Posted by rforno at tutopia.com Feb 14, 2003
- 476 views
Derek: I know it's no help, but I had just the same problem when modifying RDS's Duplicate File Finder to correct a bug and enhance it. I was unable to find a solution, as it is said in the corresponding source file (: Regards. ----- Original Message ----- From: Derek Parnell <ddparnell at bigpond.com> Subject: Re: Current Directory > > On Wed, 12 Feb 2003 21:59:44 -0500, Greg Haberek <g.haberek at comcast.net> > wrote: > > > > > Let's do some pseudo-coding! This tends to help me in my engineering > > classes.... > > > > Step 1: User provides file > > > > -- begin test file -- > > > > -- filename: C:\Euphoria\files.txt -- > > -- please note that the current directory would start at C:\Euphoria -- > > > > .\test.dat -- file 1 (in C:\Euphoria) > > ..\test1.dat -- file 2 (down one path) > > D:\test2.dat -- file 3 (different drive) > > ..\TestFolder\test3.dat -- file 4 (this is on drive C:, since > > C:\Euphoria is the original > > directory) > > C:\TestFolder\test3.dat -- file 5 (same as file 4) > > D:\FolderName\..\test2.dat -- file 6 (same as file 3) > > > > -- note that the current directory this whole time never changes, -- > > -- we figure out the pathes based on the base directory -- > > > > -- end test file -- > > > > Step 2: Filter out duplicate names > > > > -- begin pseudo-code -- > > > > function full_path( sequence path ) > > -- return a full path name, taking into account any .. or . > > end function > > > > sequence list_of_files > > > > while 1 do > > > > -- read a line from the text file > > -- parse it into a full_path() > > -- look it up in list_of_files > > > > if found then > > -- ignore it, file already listed > > > > else > > -- add it to the list > > > > end if > > > > end while > > > > -- end pseudo-code -- > > > > Step 3: Begin coding program... > > > > > > I'm pretty sure this is what Derek wants his program to do! > > Almost, but not quite. How would the algorithm above handle these two > specs... > > D:FolderName\..\test2.dat > > Notice that there is NO "\" between the ":" and the "FolderName". This is > the situation that I don't know how to handle. > > Then if D:\XYZZY\test2.dat is supplied, how can I know if that is the same > file as D:\FolderName\..\test2.dat ? It is possibly the same file, but > maybe not also. > > -- > > cheers, > Derek Parnell > > > > TOPICA - Start your own email discussion group. FREE! >