Can anyone lend a hand deciphering why my code will not produce any results except for the last print statement, the sum of files and file sizes? I can't get the GetFileSize and getFileTime functions to produce any results. If you can't tell from the code, I'm trying to print a continually updated list of archived files in a directory (something like the ps process command in UNIX). I also need to figure out how to create a text file of the output (list of files within the directory) and save it to a different location at 3:57 every day. I'm still scratching my head, working with Date::Manip::parserecur(). I'll leave that question for later and focus on the present issue. Any and all Perl guru's, please take a look at my code. I exhausted all other resources and would really appreciate any help. Thanks in advance.

Re: [gixxer05] No results from using GetFileTime and getFileSize
[In reply to]

Can't Post

Why aren't you using the strict pragma?

I commented out strict at my last compile, before posting, to debug with warnings. I still plan on using it.

Why Are you using the Win32API modules instead of Perl's built-in stat function?

I tried using the stat functions, even POSIX, to no avail. It seems I'm getting further along by using the current method of extracting file data. However, I have only been able to produce the file name and size for output, excluding the creation time.

Why do you load 3 date/time modules but never use them? The 3 modules are included because I reworked the code atleast 5 times, using those modules because processing must occur at timed intervals and paths/files have to be named as follows: yyyy\April\mm-dd-yyyy. Create the reports directory list, as a text file, on each Monday thru Thursday at 3:58 am, save the file to the curent day's folder. Then repeadetly list (10 second pause, daemon) the directory contents from 5 am to 3:57 am the next day. Send directory file list created between Friday 5am to Monday 3:57am to the numbered date for last Friday.

I already completed code for creating the folders for each year, month, day.

Why are you using printf without specifying a format?

A little confused on how to format my output for this output. Couldn't find anything similar on the net with mixed output, can you offer an example?

Array's are 0 indexed, meaning the first index is 0 not 1. "Off by 1" is the second most common mistake.

So should I preincrement instead of post increment? How will this make a difference since there should be a filename at 0. It should be file[0] = filename, correct? Please explain a little further.

Re: [gixxer05] No results from using GetFileTime and getFileSize
[In reply to]

Can't Post

In Reply To

I commented out strict at my last compile, before posting, to debug with warnings.

Those pragmas should be used together, as apposed to either/or. The strict pragma would have told you about the @files problem I mentioned.

In Reply To

I tried using the stat functions, even POSIX, to no avail. It seems I'm getting further along by using the current method of extracting file data. However, I have only been able to produce the file name and size for output, excluding the creation time.

The stat function returns a 13 element list. The 11th element is the ctime, in Windows that's the file creation timestamp.

In Reply To

Why do you load 3 date/time modules but never use them? The 3 modules are included because I reworked the code atleast 5 times, using those modules because processing must occur at timed intervals and paths/files have to be named as follows: yyyy\April\mm-dd-yyyy.

That could easily be accomplished with the strftime function in the POSIX module.

In Reply To

Why are you using printf without specifying a format?

A little confused on how to format my output for this output. Couldn't find anything similar on the net with mixed output, can you offer an example?

Re: [FishMonger] No results from using GetFileTime and getFileSize
[In reply to]

Can't Post

Thanks for your replies, they've been quite helpful. I recreated the code, attempting to implement your stat and suggestions. The following code compiles without errors or warnings, but doesn't produce any output except:

Hard fail, but say why ($!): No such file or directory

I didn't have an issue accessing my directory before. What am I missing? Thanks again.

Re: [FishMonger] No results from using GetFileTime and getFileSize
[In reply to]

Can't Post

Good afternoon,

I made your suggested revisions to the code. Thanks. However, I still don't get the proper output. After revisements, the following code produces only directory information. I need all underlying files within the directory showing size and time. What's wrong with my code? I have yet to produce size and time data for each file outside of using system(dir).

Re: [FishMonger] No results from using GetFileTime and getFileSize
[In reply to]

Can't Post

Ah! Thanks! Interesting how you passed the path/filename to stat(). Also, can you provide tip or two when scoping variables. I'm impressed that the code didn't flag for uninitialized globals. I guess because you encapsulated the variables by declaring them within their respective blocks. Would declaring global variables cured my problems also, are there some circumstances where I should? (I know that practice is taboo in the world of Perl, but just wondering) Thanks.