Mr Snrub Posted January 11, 2006 Share Posted January 11, 2006 Okay got it, your file must have had a space in the name - sorry my fault.Copy & paste this into the batch file instead:@echo offset SRCDIR=f:\test1set DSTDIR=f:\test2for /f "delims=" %%a in ('dir /b "%SRCDIR%"') do ( if not exist "%DSTDIR%\%%a" echo Copying %%a if not exist "%DSTDIR%\%%a" copy "%SRCDIR%\%%a" "%DSTDIR%" > nul)This stops a space being a valid token delimiter and screwing up filenames. Link to comment Share on other sites More sharing options...
eyeball Posted January 11, 2006 Author Share Posted January 11, 2006 Fantastic!! you are the king of batch files!were did you learn such intricate knowledge of them? any paticular book? or just years of experience?thanks ever so much Link to comment Share on other sites More sharing options...
gunsmokingman Posted January 11, 2006 Share Posted January 11, 2006 This VBS script check for TFile, this would be the Path and File name varible. If The Tfile is found it has a message box that popups up and confirms the Tfile it will then start the copy of the file. If it not there then it will popup a error message.This is a Simple If Exists StatementConst OverWriteExisting = True Dim Fso ,TFileSet Fso = Createobject("Scripting.FileSystemObject")TFile = "YOUR_PATH_AND_FILE_NAME_HERE"If Fso.FileExists(TFile) Then msgbox "Confirm The File Was Found", 0 + 32,"Found The File"Fso.Copy(TFile),("YOUR_NEW_LOCATION"),OverWriteExistingElsemsgbox "Cannot Find The File", 0 + 32,"Can Not Fine File"End If Link to comment Share on other sites More sharing options...
Mr Snrub Posted January 12, 2006 Share Posted January 12, 2006 Fantastic!! you are the king of batch files!were did you learn such intricate knowledge of them? any paticular book? or just years of experience?thanks ever so much Experience.If you have a need, such as you did, then it pays to be inquisitive - and back when I started playing with PCs you only had DOS.Some things are just so much easier with a simple batch file than relying on tools, GUIs or scripting engines. Link to comment Share on other sites More sharing options...
Zxian Posted January 12, 2006 Share Posted January 12, 2006 Moved to Programming. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now