Re: Debugging Help Please! :) File renaming...




"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message
news:uD6AeOeFJHA.616@xxxxxxxxxxxxxxxxxxxxxxx

"Dakota Interactive" <onebucktraffic@xxxxxxxxx> wrote in message
news:03293d0a-8a5a-455d-9bf2-d660bf94db81@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
My apologies... here is the entire thing, fully commented.

<snip>


After I've had a bit of a look at your code I was left somewhat confused.
Here is why:
- You declare objFSO three times. Why?
- You have two subroutines called ScanSubFolders. Why?
- You have these two lines of code:
If fso.DriveExists("Y:") Then WshNetwork.RemoveNetworkDrive
"Y:",True,True
wshShell.Run "subst Y: /D"
What is the point of removing a non-existing substitution?
- You have these three lines of code:
For Each File In colFiles
Set objFile = objFSO.GetFile(strFolder & "\" & File.Name)
Next
What is the point of repeatedly creating an object without doing
anything with it?
- The lines
strDate = Left(objFile.FileName & "_" & objFile.CreationDate, 30)
strNewName = objFile.Drive & objFile.Path & strDate & "." & "pst"
will set strNewName to a string that includes the date in universal time
format,
which is unsuitable for a file name.

Analysing and debugging some 250 lines of someone else's code can take a
lot of time unless the issue is straightforward. I suggest you describe in
functional terms what you're trying to do. I suspect that someone will
then suggest a simple solution to your problem.

Exactly. Also, it is even more difficult to determine the cause of a
particular problem in someone's code when there are so many problems with
it.

Here is an earlier post:

This code segment is part of a larger script that moves PST files so
that they are accessible to users anywhere in the network. The rest of
the script works but this is making me nuts. This is supposed to
determine if two or more files have the same name, and if so, rename
them to include the file dat or timestamp as well. It doesn't work.
Can some offer some guidance?

Your definition of the task is a bit suspect. If I were writing such a
script I would never even bother to figure out if more than two files had
the same name. Rather, for each file processed in turn, I would determine if
a file of the same name existed in the target folder, and then copy it under
a new name if necessary.

But, given that some files will be given new names, why not simply do that
to all of the files placed there?


/Al


.



Relevant Pages

  • Re: RFC: Building the Perfect Tabbed Pane (an tutorial article)
    ... manipulation. ... that logic must reside in a script block ... head shouldn't be an issue as long as the script is after the closing ...
    (comp.lang.javascript)
  • Re: Javascript: string detection
    ... this script doesn' work, probably, because of the wrong syntax. ... A complete syntax check is better left to the server where existing code is more readily available and not a burden on the client. ... Be aware that even the regular expression above is restrictive as it won't accept literal IPv6 addresses, those that contain display names, or comments in some locations. ...
    (comp.lang.javascript)
  • Re: FMA 39 - The Secret of Ishbal
    ... >>> sacrifice of lives to the philosopher's stone. ... That's why Ed didn't go to Mustang - Archer isn't smart ... >> enough to suspect that Ed has motives of his own. ...
    (rec.arts.anime.misc)
  • Re: Grep and mv
    ... Or just the ones you have created with the script? ... > My silly little grep script extracts the names as ... > The error messages I get when running this script are: ...
    (comp.unix.shell)
  • Re: FMA 39 - The Secret of Ishbal
    ... >>> sacrifice of lives to the philosopher's stone. ... >> enough to suspect that Ed has motives of his own. ... >>> truth about the Grand Arcanum fairly well, ...
    (rec.arts.anime.misc)