copy & rename files

October 13, 2009 at 22:16:54
Specs: Windows XP
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


See More: copy & rename files

Report •


#1
October 14, 2009 at 01:01:46
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 felicity

M2


Report •

#2
October 14, 2009 at 01:05:49
It got a bit mangled, but you get the idea.


=====================================
Helping others achieve escape felicity

M2


Report •

#3
October 14, 2009 at 15:23:25
Is this what you mean?
FPP_maps
/LJS_Highlands
/FPP_newroads.(shp).(shx).(dbf)

Report •

Related Solutions

#4
October 14, 2009 at 15:55:28
Sorry - Is this what you mean?
FPP_maps
........ /LJS_Highlands
............../FPP_newroads.shp
............../FPP_newroads.shx
............. /FPP_newroads.dbf

Report •

#5
October 15, 2009 at 06:28:25
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 felicity

M2


Report •

#6
October 15, 2009 at 20:13:49
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??


Report •

#7
October 15, 2009 at 21:15:02
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 felicity

M2


Report •


Ask Question