Arthur Fuller
artful at rogers.com
Fri Feb 14 11:50:00 CST 2003
Assuming that you're in SQL not MDB, this works: xp_cmdshell 'Dir f:\' This returns a one-column temp table whose rows look like this: Volume in drive F is Data Volume Serial Number is A978-5961 NULL Directory of f:\ NULL 01/23/2003 08:35 PM <DIR> Access 10/30/2002 07:03 AM <DIR> Application Construction Kit Factory 01/23/2003 08:38 PM <DIR> Apps 10/19/2002 01:41 AM <DIR> Audio 12/31/2002 02:36 PM <DIR> Backups ... 02/12/2003 12:48 PM <DIR> vss 3 File(s) 203,637,526 bytes 33 Dir(s) 5,059,440,640 bytes free NULL Given this result set, you can now sort on anything you want. In an MDB, OTOH, I think I might construct a recordset based on Dir() and form whatever columns I might need to simplify the sort (i.e. if you want the last two chars of the filename, grab them in the select, don't parse later). Hth, Arthur -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] On Behalf Of Gustav Brock Sent: February 14, 2003 10:44 AM To: Oleg_123 at xuppa.com Subject: Re: [AccessD] (Really Really OT) - programatically sorting files in a folder Hi Oleg It's Friday and you are a man of great humour! Never seen a specification like this: not alphabetical, and it has to include wildcards So how? Date? Size with wildcards? Writing a custom sorting routine in a batch file is not trivial, and if you display the file list in Windows Explorer it will be sorted as to the settings of Windows Explorer anyway. To sort the folder (directory) itself you'll have to recreate it and fill in the files again one by one in the order you decide. Again, Explorer will ignore it - but Dir() will not. /gustav > Hey, since its Friday, i guess i can post an OT question. :) > I have a folder where I import about 30 files every day. The names are > almost the same except for last 2 digits. ex. Veronica03 on one day > Veronica04 or tne next. Can I have a batch file or something that would > sort them in the order that I need ? (not alphabetical, and it has to > include wildcards) _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com