Generate a list of folders...

August 27, 2010 at 03:01:22
Specs: Windows 7
OK. Here is what I want to do.

I want a batch files that compares the directory structure of source folder and the directory structure of destination folder and outputs a text file containing the names of those folders which are only in the source folder (there are sub-directories as well).

Possible? If yes, please help me in this.

Thanks!


See More: Generate a list of folders...

Report •

#1
August 27, 2010 at 04:56:01
you can download diffutils for windows, then do this


c:\> diff c:\folder1 c:\folder2
</pre">

GNU win32 packages | Gawk


Report •

#2
August 30, 2010 at 09:11:45
@echo off
title Directory and File Nama Printer
color 9F

:chk1
title Directory and File Nama Printer
cls
color 9F
if exist fileListDir.txt goto :errA
if not exist fileListDir.txt goto :chk2

:errA
cls
echo Directory already printed !
echo.
echo If you not delete this file,
echo in the future if you print again, to earlier text will be added !
echo.
set /p tsk="Do you want to delete printed directory first or not ? [y/n] :"
if not defined tsk goto :chk2
if %tsk%==1 goto :del1

:del1
del /f /q "fileListDir.txt"
goto :chk2

:chk2
if exist fileListFile.txt goto :errB
if not exist fileListFile.txt goto :chk3

:errB
cls
echo Files already printed !
echo.
echo If you not delete this file, 
echo in the future if you print again, to earlier text will be added !
echo.
set /p tsk="Do you want to delete printed file first or not ? [y/n]:"
if not defined tsk goto :chk3
if %tsk%==1 goto :del2

:del2
del /f /q "fileListFile.txt"
goto :chk3

:chk3
if exist fileListComplete.txt goto :errC
if not exist fileListComplete.txt goto :Str

:errC
cls
echo Files and directory already printed ! 
echo.
echo If you not delete this file,
echo in the future if you print again, to earlier text will be added !
echo.
set /p tsk="Do you want to delete printed file first or not ? [y/n]:"
if not defined tsk goto str
if %tsk%==1 goto :del3

:del3
del /f /q "fileListComplete.txt"
goto :str

:Str
title Directory and File Nama Printer
cls
color 9F
echo What do you want to print ?
echo.
echo 1. File name with extension only.
echo 2. Directory only.
echo 3. Both directory and file.
echo 4. Delete previous printed file. 
echo 5. Exit.
echo.
set /p tsk="Select option: [1-5]: "
echo.
if not defined tsk goto:err
if %tsk%==1 goto:fil
if %tsk%==2 goto:dire
if %tsk%==3 goto:both
if %tsk%==4 goto:chk1
if %tsk%==5 goto:err

:fil
title File Name Printer - command
dir  /b /aa >>fileListFile.txt
cls
color f0
type fileListFile.txt
echo.
echo.
echo Printed ! check in current directory ....
echo _______________________________________________________________________________
echo.
echo 1. File name with extension only.
echo 2. Directory only.
echo 3. Both directory and file.
echo 4. Delete previous printed file. 
echo 5. Exit.
echo.
set /p tsk="Select option: [1-5]: "
echo.
if not defined tsk goto:err
if %tsk%==1 goto:fil
if %tsk%==2 goto:dire
if %tsk%==3 goto:both
if %tsk%==4 goto:chk1
if %tsk%==5 goto:err

pause >nul


:dire
title Directory Printer - command
dir  /b /ad >>fileListDir.txt
echo fileListDir.txt supposed to be can be found in the current directory now !
cls
color f0
type fileListDir.txt
echo.
echo.
echo Printed ! check in current directory ....
echo _______________________________________________________________________________
echo.
echo 1. File name with extension only.
echo 2. Directory only.
echo 3. Both directory and file.
echo 4. Delete previous printed file. 
echo 5. Exit.
echo.
set /p tsk="Select option: [1-5]: "
echo.
if not defined tsk goto:err
if %tsk%==1 goto:fil
if %tsk%==2 goto:dire
if %tsk%==3 goto:both
if %tsk%==4 goto:chk1
if %tsk%==5 goto:err

pause >nul

:both
title Directory and FileName Printer - command
echo ====================================== >>fileListComplete.txt
echo [Directory] >>fileListComplete.txt
echo ====================================== >>fileListComplete.txt
dir  /b /ad  >>fileListComplete.txt
echo ====================================== >>fileListComplete.txt
echo [File Name] >>fileListComplete.txt
echo ====================================== >>fileListComplete.txt
dir  /b /aa >>fileListComplete.txt
echo.
echo fileListComplete.txt supposed to be can be found in the current directory now !
cls
color f0
type fileListComplete.txt
echo.
echo.
echo Printed ! check in current directory ....
echo _______________________________________________________________________________
echo.
echo 1. File name with extension only.
echo 2. Directory only.
echo 3. Both directory and file.
echo 4. Delete previous printed file. 
echo 5. Exit.
echo.
set /p tsk="Select option: [1-5]: "
echo.
if not defined tsk goto:err
if %tsk%==1 goto:fil
if %tsk%==2 goto:dire
if %tsk%==3 goto:both
if %tsk%==4 goto:chk1
if %tsk%==5 goto:err

pause >nul

:err
cls
title Directory and File Nama Printer
color 9F
echo Nothing printed...
echo Yes sir.... application now will close ! 
echo.
pause


Report •

#3
August 30, 2010 at 12:01:11
Can you please explain the code...

Where should I give the directories names?

I am new to this, so a little help will be greatly appreciated...


Report •
Related Solutions


Ask Question