Jump to content

SnakePliskin

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Everything posted by SnakePliskin

  1. Brilliant! Thanks a bunch. Don't know why I didn't think of that! jaclaz
  2. Hi I'm doing a batch file that will check if ANY file exists in particular a directory. If so it creates an archive directory and archives said files before running the communications portion of the script to send and receive files. If no file exists it will use GOTO to jump directly to the communications. I need it to skip archiving if no files exist so that it does not create empty directories every time she task scheduler runs it. I know this will work if there is a file mask set, because I have tried it. My problem is that there is no real way to set any kind of file mask to look for (i.e. C:\filesout\partoffilename*.txt). The files that are being generated have no common naming convention. There is no way to change this in the app that creates the files. So I have tried (C:\filesout\*.*) This doesn't work as it runs the archive portion of the script even if no files exist. Any assistance would be greatly appreciated. Script below with comments. The part that's giving me issues is the (if exist "F:\EDIout\*.*") rem #####################rem #CD to EDI directory#rem #####################F:cd "F:\EDIout"rem ################################################################rem #First Check if files exist to be sent so we don't end up #rem #creating a bunch of empty directories. #rem #If not, bypass the archive step and go right to SND/RCV comms.#rem ################################################################if exist "F:\EDIout\*.*" (goto archive) else (goto comms):archiverem ########################rem #Set date and time Vars#rem ########################For /F "Tokens=1-7 Delims=/:. " %%d In ("%Date%%Time%") Do Set destDir=%%f-%%e-%%d_%%g.%%h.%%i.%%jrem #######################################rem #Check if dir exists. If not create it#rem #######################################if not exist "F:\EDIout\Archive\%destDir%" mkdir "F:\EDIout\Archive\%destDir%" rem ############################rem #copy files to tarchive dir#rem ############################copy "F:\EDIout\*.*" "F:\EDIout\Archive\%destDir%":commsrem #############################rem ## Comms Stuff goes next ##rem #############################
×
×
  • Create New...