Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
zagix
- Posts: 68
- Joined: 16 Oct 2013 23:19
#1
Post
by zagix » 07 Feb 2014 12:50
Hi,
I have this script to compare the folders. But i need a change it takes full file name as condition for comparing the files within the folders, whereas i want the script to compare the files with only 29 characters of file name and leave the rest.
Code: Select all
@echo off
for %%a in ("folder1\*.*") do (
if not exist "folder2\%%~nxa" echo missing in folder2 - "%%a"
)
pause
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 07 Feb 2014 15:32
Code: Select all
@echo off
setlocal enabledelayedexpansion
for %%a in ("folder1\*.*") do (
set fname=%%~nxa
set fname=!fname:~0,29!
if not exist "folder2\!fname!*" echo missing in folder2 - "%%a"
)
pause
-
zagix
- Posts: 68
- Joined: 16 Oct 2013 23:19
#3
Post
by zagix » 08 Feb 2014 12:36
Hello,
Thanks Squashman for helping.
Thanks