Page 1 of 1 1
Topic Options
#198073 - 2010-03-16 09:12 AM Using dirlist.udf to get all dirs in location, then check creation date
Curious Offline
Getting the hang of it

Registered: 2004-02-16
Posts: 61
Hello.

I am using dirlist to get an array to check all dirs in a given location. In all dirs returned, I need to extract creation month, date etc.

The script is something like this:

 Code:
Call "udf\dirlist.udf"

$Files = Dirscan('\\fmtefil1\tsprofiler', 1) ; return a list of all files with complete paths
			
For Each $file In $Files
			 
'Filnavn: $file' ?		

			

$check = GetFileTime('$file',"1")

$Createyear = SubStr("$check",1,4)
$CreateMonth = SubStr("$check",6,2)
$CreateDate = SubStr("$check",9,2)
'Month: $CreateMonth' ?
'Date : $CreateDate' ?
;then some checking will be done
---
---
Next


All dirs return as I want, but I am not able to extract the $CreateYear, month and date, which is essential to process the dirs further.

I am doing something wrong, but can't seem to find out what it is.

Anyone??

Regards
/J
_________________________
I was placed on earth to do a job. Right now I have so much to do, I will never die..

Top
#198075 - 2010-03-16 09:57 AM Re: Using dirlist.udf to get all dirs in location, then check creation date [Re: Curious]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
In your script you get the folder name but not the full path. The DirScan UDF will return the full path if you sue 0 as the second parameter. You have it set to 1, this will return the folder name but not the path so GetFileTime will fail because it cannot find the folder.

A few comment:
  • Do not use variables inside quotes. The script below is altered to have all variables outside any quotes.
  • You use single and double quotes for the same purpose. Although they match and therefore should not cause any problems it would be better to use single or double quotes and not mix them in one and the same script.


The script below works great for me (with a different folder to scan ;\) ).
 Code:
Break on

$Files = Dirscan("\\fmtefil1\tsprofiler", 1) ; return a list of all files with complete paths
			
For Each $file in $Files 
	"Filnavn: " + $file ?		
	$check = GetFileTime($file,"1")
	$Createyear = SubStr($check,1,4)
	$CreateMonth = SubStr($check,6,2)
	$CreateDate = SubStr($check,9,2)
	"Month: " + $CreateMonth ?
	"Date : " + $CreateDate ?
	;then some checking will be done
Next

Sleep 5
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#198103 - 2010-03-19 04:43 PM Re: Using dirlist.udf to get all dirs in location, then check creation date [Re: Mart]
Curious Offline
Getting the hang of it

Registered: 2004-02-16
Posts: 61
I was sure that I posted a post just minutes after, because I saw what I had been doing wrong (allthough the script surely can be improved), but I must have forgotten to post it.

But tnx anyway Mart, appreciating you are correcting me, have been unsure of when to use the " and when to use the '

And.. I was using Dirscan, because I only need to check the Dirs in the directory of choosing.

Tnx

Regards /J
_________________________
I was placed on earth to do a job. Right now I have so much to do, I will never die..

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.133 seconds in which 0.072 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org