greasedman
29th June 2005, 17:29
Do someone know a way to get the number of files/dis in a directory given as input??!

Hitesh Shah
29th June 2005, 19:43
Search dir.entry on this forum . U should be able to count the files using dir functions.

NPRao
29th June 2005, 19:59
Hitesh's idea is good to make a OS independent functionality in BaaN. If its gets too complicated to handled multi level subdirectories, then you can use the OS options -

I see you are on Windows. Use the following command from the app_start() and redirect the output to a file and then read the last 2 lines in that files and you will get the information.
C:\>dir directory-name /s

68 File(s) 66,473,972 bytes

Total Files Listed:
1157 File(s) 600,298,492 bytes
296 Dir(s) 37,939,855,360 bytes free
Check for the DOS dir command help -


C:\>dir /?
Displays a list of files and subdirectories in a directory.

DIR [filename] [/A[[:]attributes]] [/B] [/C] [/L] [/N]
[/O[[:]sortorder]] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.

greasedman
30th June 2005, 14:45
Thanks a lot, it was helpful!

I tried to follow dir.entry() way, just beacause it is more comfortable for me.

Actually, my problem is that i'm working on a remote dir, and dir.open() always returns 0.
I tried also to create a dir with the same path, but it's not able to do that: i'm using a path like: "\\xxx\yyy\zzz", where xxx is hostname.
Of course i have permission for that folder anche for the parent folder, both for my user and for baan server's user...

The problem is that he can't open/create a dir remote (but same workgroup).

Isn't it possible?

Hitesh Shah
30th June 2005, 17:31
If u access the location while u r in the server (not from client) then map a drive to it and it should be able to access in Baan also.

For network location outside the server, NP's app_start is a good idea.

greasedman
30th June 2005, 17:47
I would let baan to create a directory on a server every time a user creates a new customized item.
This is not the baan server, but in the same network and workgroup of baan server. I'm able to get permission to both sides (server and client), but bann doesn't create and open it :confused: