Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi Everyone,
I'm looking for some help with a copy/rename problem. I have a series of files (.shp,.shx,.dbf) that sit in a series of uniquely named folders
eg FPP_maps/LJS_Highlands/FPP_newroads.(shp).(shx).(dbf)
FPP_maps/LJS_East/FPP_newroads.(shp).(shx).(dbf)
FPP_maps/HJN_Porters/FPP_newroads.(shp).(shx).(dbf)What I'd like to do is copy all the files to one location. My problem is that all the files are named the same and I can't rename them in their current location. I what I need the batch file ito do is copy and then rename the files in a sequential order. If it was the other way around ie rename then copy I could do that.
Anyone got any ideas - any help would be greatly appreciated
Thanks
Helena

That's pretty cluttered up. Might help to post a TREE, like this:
C:\TEMP
└───-
├───d10
│ └───gtest
├───proxy
├───pm
├───ftp
└───prime
├───list
├───x
└───RPN
└───RPNCalc
=====================================
Helping others achieve escape felicityM2

It got a bit mangled, but you get the idea.
=====================================
Helping others achieve escape felicityM2

Sorry - Is this what you mean?
FPP_maps
........ /LJS_Highlands
............../FPP_newroads.shp
............../FPP_newroads.shx
............. /FPP_newroads.dbf

not tested
========================@echo off & setLocal enableDELAYedexpansion set N=0 for /f "tokens=*" %%a in ('dir/b/s/a-d *.shp *.shx *.dbf') do ( set /a N+=1 if !N! LSS 10000 set S=!N! if !N! LSS 1000 set S=0!N! if !N! LSS 100 set S=00!N! if !N! LSS 10 set S=000!N! echo copy "%%a" d:\mapstuff\"%%~Na!S!%%~Xa" )
=====================================
Helping others achieve escape felicityM2

thanks for the reply. The batch file runs okay but nothing actually copies. I've tried it copying it to a folder that already exists and one that doesn't.
Each line states something like
copy "E:\Temp\fpp_newroads.shx" E:\projects\"fpp_newroads123.shx"Any ideas??

Soory, I should have told you: as posted, it simply previews what's to be done. For saftey.
To activate it, remove the ECHO which precedes COPY.
=====================================
Helping others achieve escape felicityM2

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |