473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem parsing the directory

Hi,

I am using perl in windows platform. I have a directory structure \Dir\Data\tran\Archive\TDB\Log. There are files in the TDB directory with .dat extension. I need to parse the TDB directory inorder to identify the .dat files individually. I have the logic as follows:

# file path
$input = "\\Dir\\Data\\tran\\".$ARGV[0];
$archive = "\\Dir\\Data\\tran\\Archive\\".$ARGV[0];
$archLog = $archive."\\Log";

die "Can not open archive directory"
unless (opendir ARC, $archive);

mkdir($archLog, 0777)
unless (opendir ARCLOG, $archLog);

# moving from input to archive
$mvString = "move ".$input."\\*.dat ".$archive."\\";

#
while ($fn = readdir ARC)
{
if (substr($fn,0,1) ne "." and substr($fn,0,3) ne "Log")
{
$fn =~ /.dat/ ? $fn =~ /:|MemberTranArchive/ ? ($dummy = $fn) : &mvFile($archive,$fn) : ($dummy = $fn);
}
}

closedir ARCDIR


With this logic in place, I get . and .. (current and parent directory) and finally it jumps to Log directory. The logic never looks for the files in the TDB directory.

How to make the logic work to parse the directory TDB?

The same logic works fine on unix platform. I am trying to make it work on windows.

Am I missing something here?
Feb 8 '07 #1
2 1852
KevinADC
4,059 Expert 2GB
what are ARCLOG and ARCDIR used for? What does this line do?

Expand|Select|Wrap|Line Numbers
  1. $fn =~ /.dat/ ? $fn =~ /:|MemberTranArchive/ ? ($dummy = $fn) : &mvFile($archive,$fn) : ($dummy = $fn);
Feb 9 '07 #2
@codemaster

Try this:
Expand|Select|Wrap|Line Numbers
  1. @files = glob("$yourLogDir/*.dat");
Greetz, Doc
Feb 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Young | last post by:
I'm trying to parse a directory, but am not sure of the best way of doing it. Preferably using only .net instructions. Can anyone give me an idea of how to do this? Thanks in advance for any...
2
by: Mark | last post by:
I got this code from the Internet. Demo on the site works fine but downloaded version is not. I am a very new to .NET, I cannot figure this out, please help. Here is the code: ASPX code: <%@...
3
by: Arsalan Ahmad | last post by:
Hi, I have recently uploaded a file in a webserver. When i try to access it via browser, I get following error: This is working fine in my local copy. Any idea what could be wrong. Server Error...
2
by: Brett | last post by:
I uploaded an ASP.NET website from my developer machine to a remote server. The paths differ slightly as follows: Local Path: C:\Inetpub\wwwroot\mysite Server Path: C:\Inetpub\mysite.com\ I...
2
by: Jean-Marie Vaneskahian | last post by:
Reading - Parsing Records From An LDAP LDIF File In .Net? I am in need of a .Net class that will allow for the parsing of a LDAP LDIF file. An LDIF file is the standard format for representing...
0
by: Peter D. Dunlap | last post by:
I've got a site I'm working on that works fine using the VS2005 internal browser. I need to test it from another machine on the network, so I set up a new virtual directory in IIS (on Windows XP...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
7
by: souravmallik | last post by:
Hello, I'm facing a big logical problem while writing a parser in VC++ using C. I have to parse a file in a chunk of bytes in a round robin fashion. Means, when I select a file, the parser...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I cut and paste the following code from msdn help page which it just introduces view and multiview server controls. Here is what I do: in vs studio 2005, File --New Web Site, it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.