![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a way to grab all the file names in a directory and populating a SQL table with them? I am trying to create 2 different jobs: 1) I want to get a list of all my backup files in my directory and move all files over one week old to an archive folder. 2) I want to grab zip files that are over 3GIG and move them off to a different folder as well. I need a way to grab the files by name and also by size. Is this possible? TIA, Joe |
#3
| |||
| |||
|
|
create table #dir (line varchar(255) NULL) INSERT #dir exec master..xp_cmdshell 'dir "C:\WINDOWS" /-C' select * from #dir where line IS NOT NULL and line NOT LIKE '%<DIR>%' and substring(line,1,1) <> ' ' Using SUBSTRING and CONVERT against #dir.line I leave to you. Roy Harvey Beacon Falls, CT On Wed, 19 Jul 2006 12:26:01 -0700, jaylou jaylou (AT) discussions (DOT) microsoft.com> wrote: Is there a way to grab all the file names in a directory and populating a SQL table with them? I am trying to create 2 different jobs: 1) I want to get a list of all my backup files in my directory and move all files over one week old to an archive folder. 2) I want to grab zip files that are over 3GIG and move them off to a different folder as well. I need a way to grab the files by name and also by size. Is this possible? TIA, Joe |
#4
| |||
| |||
|
|
Thank you! That did it. One thing use /B instead of /-C and there is no need for modification it will only bring in file names. |
![]() |
| Thread Tools | |
| Display Modes | |
| |