troubleshooting Question

Logon script to run new files in a dir for people if they havn't ran them before...

Avatar of jimmy6154
jimmy6154 asked on
Microsoft DOSVisual Basic ClassicWindows Batch
2 Comments1 Solution262 ViewsLast Modified:
So I hope I can explain this well enough for people to get. I am very bad at this sometime.

 So I have a group in my company that drops files in a specific location(I'll call this the "home" directory from now on). From this "home" location when there is a new addition to the folder. Each individual in a remote office runs a small .bat file (the name is never the same). The bat file does some minimal tasks like reg's dll's and copy's the files from the "home" folder to the persons local drive which is the same location. So I would like to try to automate this task via a logon script.

Things it needs to do:
Check the "home" folder for new files. If new files are there, run the .bat file.
Compare what the user has on the local drive with whats in the "home" folder. If there is discrepancy's, run what needs to be ran so that user is up to date.

I found the attached code for a DOS .bat file that sort of does what I was looking to do, but could not get it to work. I'm also not hard set on keeping the folder structure, so if you come up with something that moves files into a "processed" folder or something like that, thats ok with me.


thanks again and please ask questions if this does not make any sense.

thanks

:: CTULD.bat
:: Copies Files Modified or Created Today
::  to the Upload Directory, or Copies
::   from the Specified Date Forward
::
@ECHO OFF
                                              If no Date is Given, Today's
IF "%1" == "" GOTO COPY-TODAY                    Files will be Copied
IF NOT "%1" == "" GOTO COPY-DATE              Otherwise, Files will be Copied
                                                 Forward of the Date Typed
 
:COPY-TODAY                                   (See Text, Below)
ECHO. | DATE | FIND /I "Current" > C:\BATCH\CUR-DATE.BAT
ECHO @SET CUR-DATE=%%4 > C:\BATCH\CURRENT.BAT
CALL C:\BATCH\CUR-DATE.BAT
 
XCOPY *.* C:\UPLOAD /D:%CUR-DATE% < NUL       Copies Files based on
                                                 Today's Date
                                                 ("NUL" Hides Screen Messages)
GOTO END
 
:COPY-DATE                                     Copies Files based on
XCOPY *.* C:\UPLOAD /D:%1 /-Y                     The Date Given at the
                                                  Command Line
:END
ECHO.                                          Separates the Listing
CALL C:\BATCH\DR.BAT C:\UPLOAD                 Gives a Listing for the
                                                  UPLOAD Directory to
                                                  Show the Operation's Success
 
SET CUR-DATE=                                  Removes the Date Variable
                                                 From the Environment
 
DEL CUR-DATE.BAT                                  Deletes the
DEL CURRENT.BAT                                            Temporary Batch Files
                                ________
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros