[<<]Message[>>]    [<<]Author[>>]    [<<]Subject        [<<]Thread    

Number : 9167 Date : 2004-11-08 Author : Jeremy Rector Subject : Re: File rename revisited Size(KB) : 3
--- In xxcopy@yahoogroups.com, "Garry Deane" wrote: >=20 > --- In xxcopy@yahoogroups.com, "Jeremy Rector"=20 =20 > wrote: > >=20 > > Hi John, > >=20 > > Thanks for the tweaking. This one is a little closer. It seem > > that some of my files are using the ` symbol in the filename > > (damn users), and I need to use a different delimiter. Out of > > the chute it works, just a little oddly. I think a little > > more tweaking on my end should fix it for good. I just need > > to find a valid character that my users aren't using to use > > as a delimiter and it should do the trick. I have been working > > on the file extension problem, nice solution I overlooked the > > filename.ext issue earlier, thanks for spotting and fixing > > that. (very elegent) > > I may actually be developing a handle on this now. :) > >=20 > > Thanks Again! >=20 > Xxcopy does allow you to specify an alternate separator > character using /s e.g. /s_. Unfortunately this isn't > going to help because: >=20 > 1. Xxcopy only accepts a limited number of characters and > these are probably more commonly found than ` and you can't > use say ALT [170] =3D =AC or similar high bit characters which > wouldn't be found in the file names. >=20 > 2. It seems that Xxcopy only uses ` when rebuilding the > directories with /srr e.g. using /srr/s_ doesn't work. >=20 > Short of abandoning xxcopy and using a pure batch approach, > the best I can think of is to rename the files in the source > which contain a ` with an alternate character such as =AC. > After the renaming with the date-time field is complete, > rename them back with the ` character. Here's an example > of how you can do the rename (assuming that it's only file > names that contain ` and not directories). >=20 > @echo off > setlocal > set src=3Dd:\test\src dir > for /f "tokens=3D*" %%a in ('dir /s/b "%src%\*`*"') do ( > set fqname=3D%%a > set fname=3D%%nxa > call :replace` > ) > goto :eof >=20 > :replace` > ren "%fqname%" "%fname:`=3D=AC%" > goto :eof >=20 > The character I've used above is ALT [170] because my editor > handles that character with grace but not some others. You > can use anything unique that's convenient. >=20 > Note however that renaming files in batch can be fraught with > problems because batch files treat fairly commonly used > characters such as % ^ ! " ( ) as special batch characters. > If your files containing ` also contain these batch characters, > you might run into problems. I haven't tested all these but I > know that % in particular is next to impossible to deal with. >=20 > If this proves too difficult, there are freely available > file renamers that can probably do the job. >=20 > Garry Thanks for the feedback Garry. Alas, I spent some time fiddling with=20 alternate characters, and it does indeed look as though my options=20 are limited. As you can imagine, I have users who regularly use all=20 sorts of characters in their file and directory names. I am looking=20 into some ways to do this with pure batch. Thanks for all of your help. :)
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.