return to tranceaddict TranceAddict Forums Archive > Main Forums > Chill Out Room

 
Script help
View this Thread in Original format
DJ Mikey Mike
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.
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.
KiNeTiC ENeRgY
why don't u ask software code issues on a trance music site?
whiskers
quote:
Originally posted by KiNeTiC ENeRgY
why don't u ask software code issues on a trance music site?


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 lover of hip-hop.
DJ Mikey Mike
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?


Because there are quite a few users on here who, unlike yourself, aren't ing useless little cunts and actually know their 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.
KiNeTiC ENeRgY
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.


false. Your logic skills suck. High IQ does not equal knowing code without prior knowledge, or anything else for that matter. I might seek out this information from a software coder site. A simple google search would get his answer.
KiNeTiC ENeRgY
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 ing useless little cunts and actually know their 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.


Funny cause I know the answer, but since u are such a ****, I won't tell u.
DJ Mikey Mike
Whatever you sad 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.
basd
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.

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.
Fledz
quote:
Originally posted by KiNeTiC ENeRgY
why don't u ask software code issues on a trance music site?

There's 87K users here. Chances are there are people that know.

If you're going to be a troll, at least be a good and entertaining one.

Joss Weatherby
quote:
Originally posted by KiNeTiC ENeRgY
why don't u ask software code issues on a trance music site?


i believe that is what he is doing... :conf:

man dos/windows batch scripts are fugly... :nervous:
DJ Mikey Mike
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.


:D

Works a treat. Thanks fella.
CLICK TO RETURN TO TOP OF PAGE
 
Privacy Statement