Tach,
ich brauch mal eure Hilfe wieder einmal
Wenn ich zwei Dateien miteinander vergleichen möchte //aber auf garkeinen Fall ausgehend von der Dateigröße sondern von der Datei(DATUM/UHRZEIT). Wie stelle ich das am besten an.
Ist es möglich mit VBSKRIPT was zu entwerfen???
DANKE.....
DATE/TIME Compare
Moderators: Dorian (MJT support), JRL
Deine Chancen steigen wenn du deine Anfragen auf Englisch stellst, da die Mehrheit der Nutzer hier in dieser Sprache kommuniziert.
Your question: DATE/TIME Compare (regarding a file)
Guess yes, VBScript makes sense. Keep in mind that there are different kind of dates used with a file: last access, modified, created.
Your question: DATE/TIME Compare (regarding a file)
Guess yes, VBScript makes sense. Keep in mind that there are different kind of dates used with a file: last access, modified, created.
Using VBSkript under Macro Scheduler
Hello people,
i have an problem. My skript needs an vbskript code because for my snychronization between two files/folders i need the correct date/hour from each file.
It is simply an query!!!
But how can i write this in code??? Could you help me people???
I have no experience in vbskript under Macro Scheduler.....
my questions are:
- which vb function ??? If File Date > < xxxx then snychronize.........
- which typ of variable .... i think integer it's to long -32xxx up to +32xxx or long, double.....
Thank you four your answer....
dd
i have an problem. My skript needs an vbskript code because for my snychronization between two files/folders i need the correct date/hour from each file.
It is simply an query!!!
But how can i write this in code??? Could you help me people???
I have no experience in vbskript under Macro Scheduler.....
my questions are:
- which vb function ??? If File Date > < xxxx then snychronize.........
- which typ of variable .... i think integer it's to long -32xxx up to +32xxx or long, double.....
Thank you four your answer....
dd
Macro Scheduler has a built in command for obtaining the date:
FileDate>filename,result
Do a search in these forums, there have been similar examples (some posted by myself) to use vbscript with date mathmatics, and obtaining file properties (like the last modified time).
Type of variable? VBScript uses 'variant' types, which can contain different types (boolean, string, integer, etc). You don't need to specify the type when you declare and use a variable.
You can probably do what you're trying to do without any vbscript.
FileDate>filename,result
Do a search in these forums, there have been similar examples (some posted by myself) to use vbscript with date mathmatics, and obtaining file properties (like the last modified time).
Type of variable? VBScript uses 'variant' types, which can contain different types (boolean, string, integer, etc). You don't need to specify the type when you declare and use a variable.
You can probably do what you're trying to do without any vbscript.
VB Code in the Forum
Hello Captive,
could you tell me where i could find your posting!
Technical/Beginners?
Thanks.
could you tell me where i could find your posting!
Technical/Beginners?
Thanks.
Here's a basic example using just the date, obtained from the "FileDate" command. (Untested)
Let>MyDate=20050110
Let>MyPath=c:\temp\
Let>Target=c:\target\
GetFileList>%MyPath%*.*,files
Separate>files,;,file_names
Let>k=0
Repeat>k
Let>k=k+1
Let>filename=file_names_%k%
FileDate>%filename%,result
' The %result% contains the CREATED date in YYYYMMDD format
If>%result%%filename%,%target%
EndIf
Until>k,file_names_count
Using VBScript to get the "date created" field. Taken mostly from the vbcsript document:
VBSTART
Function GetFileCreatedInfo(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(filespec)
s = f.DateCreated
' you could use s = f.DateLastAccessed
' or s = f.DateLastModified
GetFileCreatedInfo = s
End Function
VBEND
Then in the example above, instead of using "FileDate>", you could use something like:
VBEVAL>GetFileCreatedInfo("%filename%"),result
and adjust the "If", because %result% will look something like:
"2/27/2004 8:00:47 PM"
(You can tweak the function to make the result look exactly how you want to)
Let>MyDate=20050110
Let>MyPath=c:\temp\
Let>Target=c:\target\
GetFileList>%MyPath%*.*,files
Separate>files,;,file_names
Let>k=0
Repeat>k
Let>k=k+1
Let>filename=file_names_%k%
FileDate>%filename%,result
' The %result% contains the CREATED date in YYYYMMDD format
If>%result%%filename%,%target%
EndIf
Until>k,file_names_count
Using VBScript to get the "date created" field. Taken mostly from the vbcsript document:
VBSTART
Function GetFileCreatedInfo(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(filespec)
s = f.DateCreated
' you could use s = f.DateLastAccessed
' or s = f.DateLastModified
GetFileCreatedInfo = s
End Function
VBEND
Then in the example above, instead of using "FileDate>", you could use something like:
VBEVAL>GetFileCreatedInfo("%filename%"),result
and adjust the "If", because %result% will look something like:
"2/27/2004 8:00:47 PM"
(You can tweak the function to make the result look exactly how you want to)
One thing I'd like to add (this whole thread doesn't seem like it belongs in the beginners section), is that VBScript can also obtain the whole list for you, and copy the files too. You could write a function where you simply specified the "Source", the "Target", and code the function so that any files older than ... say 24 hours, or 30 minutes, etc are copied.