1.

Solve : Batch file to check multiple folders, if the folders it's checking has certain..?

Answer»

I want a batch file to check a lot of folder and check their sub folders for certain names. I am creating a Garry's Mod FastDL generator where the batch file has to check every addon (multiple folders) and check their subfolders, if they have the subfolders of the name "materials, models, sounds, SCRIPTS or particles", then it should copy it to a specific output folder, if it has any other folder, it shall NOT copy it over. This might sound confusing but if you read it carefully, you'll understand.And what have you started with so far ? ?I created a batch for Unreal Tournament 99, years ago that went in and added textures, sounds, maps, and all that. Not your specific game, but similar functionality.

You should be ABLE to just IF EXIST at a specific target locations and then if it exists dont xcopy and if it doesnt exist then xcopy the contents from your MEDIA to the drive at the specific target location.

Testing If a Drive or Directory Exists from a Batch File
https://support.microsoft.com/en-us/kb/65994

Quote from: JacobGunther12 on June 24, 2016, 03:10:49 PM

if they have the subfolders of the name "materials, models, sounds, scripts or particles", then it should copy it to a specific output folder

This is not tested:

Code: [Select]@echo off
for %%a in (
materials
models
sounds
scripts
particles
) do for /d /R "d:\base\folder" %%b in (*) do if /i "%%~nxb"=="%%a" robocopy "%%b" "c:\output folder\%%a" /mir
pause
or you know
Code: [Select]xcopy materials/* outputfolder/
xcopy models/* outputfolder/
xcopy sounds/* outputfolder/
xcopy scripts/* outputfolder/
xcopy particles/* outputfolder/
Quote from: Luigi master on June 27, 2016, 07:59:02 PM
or you know
Code: [Select]xcopy materials/* outputfolder/
xcopy models/* outputfolder/
xcopy sounds/* outputfolder/
xcopy scripts/* outputfolder/
xcopy particles/* outputfolder/

How does your script determine where those folders are in the tree of folders?
The OP is probably handing in his assignment as we SPEAK anyway.
Oh, okay.


Discussion

No Comment Found