Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
If exist any directory?
Name: Jimi Hullegård Date: October 30, 1999 at 07:45:22 Pacific
Comment:
I´m writing a bat-file. But I have a problem with the IF-syntax What should I write if I want to check if there is ANY subdir in a directory? I know that you type "if exist abc\nul ..." to check if the directory abc exists...
Name: Ryan Cooley Date: October 30, 1999 at 20:44:55 Pacific
Reply:
You can't do anything the way you want to, but if you do something similar to what I have below, you can accomplish what you want.
dir/s > ~file.tmp find filefind exe if errorlevel 1 goto found
I hope this helped.
0
Response Number 2
Name: Outsider Date: November 10, 1999 at 11:22:09 Pacific
Reply:
You can do a lot with find.exe, i.e :: isroot.bat @ECHO off CTTY nul DIR/A/W |FIND.EXE "file(s)" IF errorlevel=1 ECHO no files on drive >con IF errorlevel=1 GOTO end DIR/A/W |FIND.EXE ".." >nul IF not errorlevel=1 ECHO root directory is not current >con IF errorlevel=1 ECHO root directory is current >con :: end
The above will tell you if the root directory is current. From this you ought to be able to figure out how to do exactly what you want.
Summary: I have created a NET USE batch file that will xcopy an entire directory to a server for updating purposes, but I am having a problem with my IF EXISTS and IF NOT EXIST statements. After I use NET USE ...
Summary: I am trying to add a line in a batch file which files from a certain directory will be copied if a certain condition exists, but, they do not seem to execute, this is being used on a network, here is ...