TranceAddict Forums (www.tranceaddict.com/forums)
- Chill Out Room
-- Script help
Script help
Unfortunately my knowledge on writing scripts is very basic so I'm wondering if someone can help me.
I've written a simple script that people can run to retreive the latest version of a file from the server which then goes on to copy it to their local workstation. Now what I've done works just fine but, a requirement for it to work is for them to already have the final destination folder created on their workstation.
What I've done so far:
echo off
cls
echo You are about to update your copy of test.accdb
echo
pause
copy s:\test\test.accdb c:\progra~1\test\test.accdb /Y
echo
echo Update installed.
echo
pause
What I want to add to the above is a way for the script to check if the folder exists. If it does, then I want it to go ahead with deploying the new version of the file as normal. If it doesn't, then I want the script to create the destination folder and then continue to copy in the new file.
Is this possible? And can anyone tell me what I need to do?
Cheers.
quick google search (i'm not proficient in batch programming):
check if directory exists: IF EXIST c:\windows\nul ECHO Directory exists!
create directory: md c:\newdir
I don't know how to do a "not" in batch programming, but if you say
IF [NOT] EXIST C:/yourdir md C:/yourdir
something like that.
why don't u ask software code issues on a trance music site?
| quote: |
| Originally posted by KiNeTiC ENeRgY why don't u ask software code issues on a trance music site? |
I'll look into it whiskers, cheers.
| quote: |
| Originally posted by KiNeTiC ENeRgY why don't u ask software code issues on a trance music site? |
| quote: |
| Originally posted by whiskers You must not have been paying attention. People who listen to EDM have higher IQs than the rest of the music lovers. People with higher IQs are good with computers. QED. You must be a hip-hop lover. |
| quote: |
| Originally posted by DJ Mikey Mike I'll look into it whiskers, cheers. Because there are quite a few users on here who, unlike yourself, aren't fucking useless little cunts and actually know their shit with this sort of thing. I've asked a handful of questions like this one in the past and have always gotten the answer I wanted. |
Whatever you sad fuck I'm finishing work now. I know I'll have my answer by tomorrow, whether it be on here or on one of the other boards I've posted on. I always do.
| quote: |
| Originally posted by whiskers quick google search (i'm not proficient in batch programming): check if directory exists: IF EXIST c:\windows\nul ECHO Directory exists! create directory: md c:\newdir I don't know how to do a "not" in batch programming, but if you say IF [NOT] EXIST C:/yourdir md C:/yourdir something like that. |
| quote: |
| Originally posted by KiNeTiC ENeRgY why don't u ask software code issues on a trance music site? |
| quote: |
| Originally posted by KiNeTiC ENeRgY why don't u ask software code issues on a trance music site? |
| quote: |
| Originally posted by basd You're right. Mike, just add the following statement to your batch file: IF NOT EXIST [full dir path]\nul MD [full dir path] The '\nul' part right behind the path is the DOS (Unix?) workaround for the EXIST command to check for folders to exist, since the EXIST command on itself works on files only. '\nul' is a file which will exist in all DOS directories by default, so to say. |

Powered by: vBulletin
Copyright © 2000-2021, Jelsoft Enterprises Ltd.