Wednesday, March 28, 2012

Problem with Batch files!

Hi,
I am trying to write a batch file which does the following:
1. Move all the files created on weekdays to be sorted to their respective days folder Example: Files created on Tuesday should be moved to a folder named "Tuesday"(When the batch file is run on Wednesday).
2. Only that particular day's created files should be present in the main directory and the other files should be moved to their respective days(created days) folder!!!!!
Could you please help me out!!!!!
Thanks.
AUse xp_cmdshall with regular dos dir, copy, etc. You can save list of files in folder to temporary or permanent table like this:

create table #tmp(res varchar(700))
insert #tmp
master..xp_cmdshell 'dir myfolder'

No comments:

Post a Comment