File dates
Moderator: Rathinagiri
Re: File dates
I was using:
* Program...: AA01.prg
*
#include <hmg.ch>
SETMODE(25,80)
PROCEDURE MAIN
Local oFSO, oFS, cDate
oFSO := CreateObject("Scripting.FileSystemObject")
oFS := oFSO:GetFolder( "C:\*.*" )
cDate := oFS:DateCreated
@3,3 SAY cDate
INKEY(0)
Return
* EOF(): AA01.prg
and this produces the error result: What am I doing wrong? !!
* Program...: AA01.prg
*
#include <hmg.ch>
SETMODE(25,80)
PROCEDURE MAIN
Local oFSO, oFS, cDate
oFSO := CreateObject("Scripting.FileSystemObject")
oFS := oFSO:GetFolder( "C:\*.*" )
cDate := oFS:DateCreated
@3,3 SAY cDate
INKEY(0)
Return
* EOF(): AA01.prg
and this produces the error result: What am I doing wrong? !!
- Attachments
-
- ERROR.png (5.28 KiB) Viewed 3077 times
- mustafa
- Posts: 1175
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: File dates
Hi Templar
See the modification of Daniel's Sample
which was also giving me ERROR
https://www.hmgforum.com/viewtopic.php?f=5&t=6427
Mustafa
See the modification of Daniel's Sample
which was also giving me ERROR
https://www.hmgforum.com/viewtopic.php?f=5&t=6427
Mustafa
Re: File dates
Mmm. That runs forever until I stop it with Task Manager! Something funny going on...
Templar
Templar
- serge_girard
- Posts: 3364
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: File dates
Templar,
Error arises when you try:
Try this with existing foldername!
Serge
Error arises when you try:
Code: Select all
oFS := oFSO:GetFolder( 'c:\*.*')
Code: Select all
DirQz = 'c:\test' // or whatever existing foldername!!!!!
oFS := oFSO:GetFolder( DirQz )
There's nothing you can do that can't be done...
Re: File dates
That was what I tried buit no different! I put it into a variable, and tried setting that to "C:\" and also "C:\windows" and "C:\windows\*.*"
and got the same error message each time. Very odd!
and got the same error message each time. Very odd!
- serge_girard
- Posts: 3364
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: File dates
That's what just runs forever until I close it with TaskManager. It does seem odd. Does that work for you?
Re: File dates
Templar
For console mode:
For GUI mode:
For console mode:
Code: Select all
REQUEST HB_GT_WIN_DEFAULT
FUNCTION Main()
LOCAL cFolder := "C:\Windows"
LOCAL oFSO := CreateObject("Scripting.FileSystemObject")
LOCAL oFolder
LOCAL tCreated
SetMode(25, 80)
@ 3,3 SAY "Folder:"
@ 4,3 SAY cFolder
IF oFSO:FolderExists(cFolder)
oFolder := oFSO:GetFolder(cFolder)
IF ! oFolder:IsRootFolder
tCreated := oFolder:DateCreated
@ 5,3 SAY "has been created: " + hb_TStoStr(tCreated)
ELSE
@ 5,3 SAY "is root folder!"
ENDIF
ELSE
@ 5,3 SAY "does not exist!"
ENDIF
InKey(0)
RETURN NIL
Code: Select all
#include "hmg.ch"
FUNCTION Main()
LOCAL cFolder := "C:\Windows"
LOCAL oFSO := CreateObject("Scripting.FileSystemObject")
LOCAL oFolder
LOCAL tCreated
IF oFSO:FolderExists(cFolder)
oFolder := oFSO:GetFolder(cFolder)
IF ! oFolder:IsRootFolder
tCreated := oFolder:DateCreated
MsgBox("Folder:" + CRLF + cFolder + CRLF + "has been created: " + hb_TStoStr(tCreated), "Success")
ELSE
MsgBox("This is root folder:" + CRLF + cFolder, "Error")
ENDIF
ELSE
MsgBox("Folder does not exist:" + CRLF + cFolder, "Error")
ENDIF
RETURN NIL
Re: File dates
Sir: you are a genius! Thank you very much.
(I will, one of these days, try going onto GUI mode, but my program comprises 60 program files, each about 800 lines, so not far short of 50,000 lines of code altogether and I don't think I am young enough to gte it done during my life time!
Templar
(I will, one of these days, try going onto GUI mode, but my program comprises 60 program files, each about 800 lines, so not far short of 50,000 lines of code altogether and I don't think I am young enough to gte it done during my life time!
Templar
Re: File dates
Hold on!! How do I now extract the date element from the variable "tCreated" ? What I need to be able to do is check the date returned (ie the date the directory was created) against the date it should be. It's a "T" type variable and I need to change it either to a character string or a Date variable.
Any suggestions?
Templar
Any suggestions?
Templar