Google Answers Logo
View Question
 
Q: How can I paste multiple files with identical names in XP? ( No Answer,   20 Comments )
Question  
Subject: How can I paste multiple files with identical names in XP?
Category: Computers > Operating Systems
Asked by: rexregum-ga
List Price: $15.00
Posted: 11 Jun 2004 09:06 PDT
Expires: 11 Jul 2004 09:06 PDT
Question ID: 359712
How can I paste multiple files with identical names in XP?

The situation is thus: I have a large number of jpg images in the
Temporary Internet Files folder, all of which are named 'webcam.jpg'.

I cannot easily work with them while they are in this folder, as it is
hidden from most applications. I therefore want copy the files to
another, normal directory. The problem is, windows explorer will not
paste all of them; I get the 'Do you want to replace the existing
file...with this one...?' dialogue box. If I take 'yes' , each file
replaces the one before and I lose all but one of them. If I take
'no', one of two things happens:

1. The next file is pasted, with a new name, eg webcam[2].jpg . This
happens about 20% of the time.

2. The file is not pasted at all; it is skipped over. This happens
about 80% of the time.

Then the box comes up again until all are accounted for. I am dealing
with ~100 files at a time, so renaming them all myself is out of the
question. How can I make sure that all the files are pasted in one go?

Request for Question Clarification by rainbow-ga on 11 Jun 2004 10:26 PDT
Hi rexregum,

Would an explanation on how to rename multiple files with Windows
Explorer interest you? ( I don't mean doing them one by one.) The
files would then be named the same with a number in parentheses
appended to the name to make the new file name unique. Then you can
copy and paste as you normally would.

Regards,
Rainbow

Clarification of Question by rexregum-ga on 11 Jun 2004 23:51 PDT
Yes, that would be fine. I'm not really at home with DOS-based things,
so this sounds like the better approach to me. How do I rename multple
files at once with windows explorer, then?

Clarification of Question by rexregum-ga on 12 Jun 2004 03:12 PDT
N.B.: the images are currently in the Temporary Internet Files folder;
I don't think I can rename them while they're still there. Would your
proposed method still work?

Request for Question Clarification by pafalafa-ga on 14 Jun 2004 12:12 PDT
rexregum-ga,

I'm a bit reluctant to throw my 2 cents in the mix here, what with all
the advice you've gotten already, but...

Can't you just create a new, empty folder, and bulk copy the files
from the Temporary Internet Files folder into the new folder, using
windows explorer?

When I tried this with my XP system for files with identical names,
they copied just fine into the new folder, but with a number appended:
 testfile[1]   testfile[2]  etc.

If I understand correctly, this is the output you want, yes...?

Good luck.


pafalafa-ga

Clarification of Question by rexregum-ga on 14 Jun 2004 13:09 PDT
The problem I have repeatedly encountered is that explorer, for some
reason, assigns the same numbers more than once, and ends up either
replacing about 80% of the files with the remaining 20% or not copying
them at all.

In short, I can't get all of the files in one go, especially when
dealing with large numbers of them [~100]...

Request for Question Clarification by pafalafa-ga on 14 Jun 2004 13:22 PDT
Hmmm...it worked for me, no problem.  I don't see why you should get
the "Do you want to replace..." message, if you're copying the files
into an empty folder, where there's nothing to replace!

Are you doing the same thing I tried...highlighting all the same-named
files in the Temporary Internet folder, and then clicking on the whole
batch and dragging it into the new, empty folder?

If that doesn't work, I'm at a loss...sorry.

paf

Clarification of Question by rexregum-ga on 14 Jun 2004 22:36 PDT
I think what could be causing the problem is that the files have a
timestamp in the filename, after the file extension, which is about 12
digits long. Only the last digit changes between each file and the
next. Thanks for your assistance anyway...

Request for Question Clarification by pafalafa-ga on 16 Jun 2004 09:57 PDT
Allright.  Now I'm just tossing out a brain dump, for whatever it is
or isn't worth...

What happens if you use the "Files or Folders" Find function (from the
start menu) to find all files named 'webcam*.jpg'????

Set the "View" to Detail, so you get the full file name, path, etc.

Seems to me, they should all appear in the Results box, and you can
then easily sort them by Folder (press the "In Folder" coumn header to
sort).  They SHOULD be independently numbered in each folder, so you
can copy and paste to a new folder.  You may need to house them in
more than one new folder, however, if the copy/paste operation doesn't
autmomatically rename any duplicates.  Still, you should be able to
move them all into just a small number of discrete folders.

Kapish?

Let me know if this works, or if it blows up your computer....!

paf

Clarification of Question by rexregum-ga on 16 Jun 2004 22:55 PDT
With your inspiration I've gone one better. The trick of selecting
multple files and pressing f2 appears to work at the search results
screen; I rename one file, then all the rest are renamed without any
duplication. This works perfectly- I can even sort the files by date
last modified first, so that they're all named by time taken.

http://support.microsoft.com/?kbid=320167

I think that Rainbow was going to tell me about this, but I found it
myself quite easily, some time after he ceased posting here.

The annoying thing is that I thought of trying to use the temporary
internet files folder first; it's given me no end of grief. It made it
very hard to fathom what the problem was, and that's not helped you
much either :(

I really seem to have cracked this one now- thanks to your support. I
apologise for my incompetence with awk- it's good to know that it's
there if I need it, and I'll probably teach myself to use it at some
point.

I'm not sure who I should pay at this point; paf and rainbow are
eligible, but I seem to have beaten them to the final answer. crythias
has put in more work than either, though, but he isn't a researcher.

What's the policy in these situations? I'll split the money three ways
if that's acceptable to you...

Request for Question Clarification by pafalafa-ga on 17 Jun 2004 07:13 PDT
rexregum-ga,

I'm glad to hear you got this resolved...it was an unexpectedly sticky problem.  

For all the good work contributed in the comments section, there is no
way to pay crythias-ga -- only actual GA researchers can receive
compensation here.

Since no one actually answered your question, you needn't pay anything
at all (or...you can pay yourself, since you sort of supplied the
final answer!).

But if you would like to, you can give me the go ahead to post a
formal answer.  I will then contact rainbow-ga, and we'll work out a
fair compensation between us (researchers have done this sort of thing
before...it generally works out fine).

However it works out, though, this was the sort of question I like:  a
challenge that I just *know* has a straightforward answer...the trick
is, figuring out what it is...!

All the best,

paf

Clarification of Question by rexregum-ga on 17 Jun 2004 08:19 PDT
Well, I have to admit that it wouldn't be the first time I've gone
away from here without paying a sou, so this isn't unprecedented.
Thank you once again, then and goodbye.

Request for Question Clarification by rainbow-ga on 17 Jun 2004 15:31 PDT
Hi rexregum,

You are correct. I was going to tell you about the site you later
found yourself. I ceased posting here when I realized the method I had
in mind would not work with Temporary Internet Files which you were
interested in.

Best of luck,
Rainbow
Answer  
There is no answer at this time.

Comments  
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 11 Jun 2004 19:23 PDT
 
I'm one to use AWK95.exe for these things, so it's important to get it
from the net (it's free) and put it in your path (c:\windows is good).
One of the cool things about awk is that you only need one file to do
so much...

This program assumes a LOT of defaults (your systemdrive and cache are
on the same drive, the cache is in a somewhat "normal" place). You
need to change the P:\\ath\\to\\destination\\\\ appropriately, and
make sure to double slashes with four! slashes at the end of the path.
It assumes that there is one level deep of directories (most likely
case). It assumes that assigning webcam.jpg to directoryname.jpg is an
easy enough way to name the files. If you'd like another naming
scheme, let me know.
 

This is the code you should use in the uberbat.bat:
-=-=-=- BEGIN uberbat.bat -=-=-=-=-
@echo off
%SYSTEMDRIVE%
REM if appropriate, change .IE5 to .IE6
cd %USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5
dir /ad /b > dirlist.txt
set dest=P:\\ath\\to\\destination\\\\
rem change webcam.jpg to folder.jpg
set awk="{print(\"copy \" $1 \"\\webcam.jpg %dest%\" $1 \".jpg\")}"
del dothis.bat
awk95 %awk% dirlist.txt > dothis.bat
set awk=
ECHO check dothis.bat to make sure you like it.
echo if you do like it, then remove the REM from the next line
echo or just run dothis.bat manually.
REM dothis.bat
-=-=-=-=-=-END uberbat.bat-=-=-=-=-
Please reply and let me know your success or failure with this.
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 12 Jun 2004 07:55 PDT
 
Hey rexregum, it's no problem to me if you don't like DOS. The program
as suggested will work fine if you just double-click it (if you have
awk95.exe), even if it's on the desktop. If you give me the
destination location (where you want the files to go, where exactly
they come from (the path to your IE cache)), I'll change it for you.

Regardless, I feel someone else might find it interesting in a search.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rainbow-ga on 12 Jun 2004 14:38 PDT
 
Hi rexregum,

Unfortunately the files in the Temporary Internet Files folder cannot be renamed.

Regards,
Rainbow
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 13 Jun 2004 01:19 PDT
 
I think I understand what you want to do, crythias. I have noticed
that sometimes the files pasted end up with different names of the
form CD3FH6EY, that is, 2 letters, a number, 2 letters, a number and 2
final letters.

It appears that the files are each being pasted from different
folders, each with a different name, and the files are acquiring the
names of their folders. I suppose the Temporary Internet Files folder
doesn't actually exist per se.

If this can happen in explorer, there might be a way of forcing it to
happen in explorer. Any ideas along these lines?

I have tried, so far unsuccessfully, to get awk95 to work. I assumed
that the thing to do with your code was to copy to a text file and
rename it uberbat.bat; I hope that this is correct.

When I run this in desktop, I get a list of the folders, one level
deep, on the desktop, in the dirlist.txt file. Where exactly do I need
to place the file for it to run correctly?

If it helps you, the folder I would like the images to be placed in
has the path C:\Documents and Settings\Angharad Miller\Local
Settings\Webcam
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 13 Jun 2004 01:28 PDT
 
I haven't managed to get it to paste any files yet. I placed a file
called webcam.jpg in on of the folders listed in dirlist.txt, created
a new folder for it to be copied to, and set the path to the new
folder, but nothing happened when I ran dothis.bat. I'll keep
trying...
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 13 Jun 2004 10:34 PDT
 
dirlist.txt is a list of folders located in 
C:\Documents and Settings\Angharad Miller\Local Settings\Temporary
Internet Folders\Content.IE5
you may have problems with the code copying to a destination with
spaces in the destination name. I think I can fix that with the
changes here.

@echo off
C:
REM if appropriate, change .IE5 to .IE6
REM change here was to add quotes before and after
cd "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5"
dir /ad /b > dirlist.txt
REM If the next line splits, combine them
set dest=c:\\Documentss and settings\\Angharad Miller\\Local Settings\\webcam\\\\
rem change webcam.jpg to folder.jpg
rem \042 adds quotation mark
set awk="{print(\"copy \" $1 \"\\webcam.jpg \042%dest%\" $1 \".jpg\042\")}"
del dothis.bat
awk95 %awk% dirlist.txt > dothis.bat
set awk=
ECHO check dothis.bat to make sure you like it.
echo if you do like it, then remove the REM from the next line
echo or just run dothis.bat manually.
REM dothis.bat

PS: There is a simple registry hack that can be used to allow you to
right-click  on the Content.IE5 (actually, any) folder and run this
program, although a simple double-click should do the job.
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 13 Jun 2004 10:36 PDT
 
sorry about the double S in documentss.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 14 Jun 2004 11:50 PDT
 
I think I'm getting closer now. I had some difficulty finding the
content.ie5 folder [it doesn't show even with hidden/protected files
visible] but I got there in the end.

In dothis.bat I now get a list of files appearing, which are from the
correct folders, but they aren't copied to the target folder when I
run it.

I made a simpler folder ( c:\Webcam ) and tried that, but still no
success. Why won't the files appear in the target folder?
Subject: Re: How can I paste multiple files with identical names in XP?
From: pafalafa-ga on 14 Jun 2004 12:56 PDT
 
PS -- I added a comment today, up above, but in case you didn't see
it, here it is again:

rexregum-ga,

I'm a bit reluctant to throw my 2 cents in the mix here, what with all
the advice you've gotten already, but...

Can't you just create a new, empty folder, and bulk copy the files
from the Temporary Internet Files folder into the new folder, using
windows explorer?

When I tried this with my XP system for files with identical names,
they copied just fine into the new folder, but with a number appended:
 testfile[1]   testfile[2]  etc.

If I understand correctly, this is the output you want, yes...?

Good luck.


pafalafa-ga
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 14 Jun 2004 14:09 PDT
 
It's probably because you're running dothis.bat separately. Remove the
"REM " from "REM dothis.bat" at the end of the uberbat and let the
program run dothis.bat on its own. (This is the most likely cause of
the frustration because dothis.bat runs a copy from relative path to
absolute path and running dothis.bat separately won't (may not) ever
work from desktop. It will work from a dos prompt at content.ie5.) I
had added the review step to make sure you files at the destination
weren't overwritten, because this is pretty much an "all or nothing"
type thing. This also doesn't check if the file actually exists at the
subfolder, or the destination folder is spelled correctly. It is
pretty much brute force "copy it if it exists" type thing.

The problem I have been experiencing here with providing code is that
GA cuts off long lines, so I have to think around linewraps when
coding. Otherwise I would have included absolute pathnames in the
creation of the set awk= line.

I apologize for the inconvenience you have experienced and thank you
for the time you've already spent.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 14 Jun 2004 22:59 PDT
 
Are the pathnames case sensitive?
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 15 Jun 2004 08:56 PDT
 
rexregum-ga, 
At 22:36 PDT, you wrote
Clarification of Question by rexregum-ga  on 14 Jun 2004 22:36 PDT

I think what could be causing the problem is that the files have a
timestamp in the filename, after the file extension, which is about 12
digits long. Only the last digit changes between each file and the
next. Thanks for your assistance anyway...
-=-=-=-
At 22:59 PDT, you wrote
From: rexregum-ga on 14 Jun 2004 22:59 PDT   	 

Are the pathnames case sensitive?
-=-=-=-
To answer your last question, first, the answer is no, the pathnames
are not case sensitive.

The program I gave you will not work for you as you have now stated
the filenames are not unique. I'm really puzzled right now as to how
to assist you further. If the filenames are not unique, and the
timestamp is after the extension as you have stated in your
clarification, then I believe that your problem is merely changing
webcam.jpg.200406141152 to (perhaps) webcam200406141152.jpg, which is
an entirely different issue. The quickest way to fix it so you can use
an image viewer is to copy all the webcam.jpg.############'s to one
folder and then
(within that folder at a dos prompt)
ren *.*.* *.*.*.jpg

I agree with Google Answer Researcher pafalafa-ga, though. The
copy/paste with bracketted numbers is the easiest when the files are
actually the same.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 15 Jun 2004 09:10 PDT
 
To crythias, Palalafa, Rainbow et al: 

I think I now understand why I am getting this error. The temporary
internet files folder, it seems, is no more than a convenient way of
viewing- just viewing -all the downloaded files in one place. Thus
files cannot be renamed there. The files are actually kept in a hidden
system of folders, i.e. two levels in, inside the content.ie5 folder,
which I shall call subfolders. The files are split in no easily
discernable way between these subfolders.

Now when multiple files with identical names are saved in one of these
subfolders, the usual system of [number] at the end of the filename
comes into effect. None of these subfolders can see that the other
subfolders can also contain files with the same name, so in each
subfolder there could be a webcam.jpg, webcam[1].jpg, a webcam[2].jpg
and so on.

The confusion arises because the temporary internet files folder only
shows the original filenames, without [number] on the end. So when I
try to copy the files from the temporary internet files folder, I am
in fact copying several of webcam[1].jpg or webcam[2].jpg, each from
different folders. Windows presumably sees that the filenames have
already been appended and stops there, refusing to rename them again.

Files can be renamed in these subfolders. 

Is there a script that could change part of the name of the files in
each of the subfolders differently? That way there wouldn't be any
duplication of file names between folders and I could copy them
normally, via the temporary internet files folder. e.g. for the first
folder: web1cam.jpg, for the next web2cam.jpg and so on. Then windows
could just add the number onto the end as normal, and wouldn't replace
files when copying.

crythias: The script is copying some of the files as it stands, but I
don't think it's copying them correctly; there has been no more than
one file turning up from each subfolder, and the files that have
appeared are mostly or entirely blank, though partially correct [i.e.,
right resolution/image size]. I think I would be more than happy with
a script that just renamed the files based on which subfolder they
were in and left them there. Thank you for your help.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 15 Jun 2004 09:20 PDT
 
I'd better reply to what you just said; I didn't see it before I made
my last post as it took quite a while to proofread.

I think that I was mistaken about the timestamp. It is only displayed
when viewing the folders in the temporary internet files folders, not
when viewing them in the subfolders in content.ie5

It looks something like this: webcam.jpg?14085839786

I know that the ? symbol is not allowed in windows as part of
filenames; I strongly suspect that the problem is as I have outlined
in my previous post. I now think that the timestamp has nothing to do
with this problem.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 15 Jun 2004 09:22 PDT
 
Minor correction: for "It is only displayed
when viewing the folders..." please read "It is only displayed
when viewing the files...".
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 15 Jun 2004 16:45 PDT
 
OK, because this requires a bit more than one line of code, may I
kindly request you make one more text file and save it?

-=-=-updated uberbat.bat-=-=-=-
REM @echo off
C:
cd "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5"
REM the unfamiliar /b is a "bare" directory listing.
REM it also happens to prepend a directory to a file!
dir /a /s /b webcam*.jpg > dirlist.txt
del dothis.bat
REM change was to call the file. Make sure it is c:\parse.awk
awk95 -f c:\parse.awk dirlist.txt > dothis.bat
ECHO check dothis.bat to make sure you like it.
echo if you do like it, then remove the REM from the next line
echo or just run dothis.bat manually.
REM dothis.bat
-=-=- END uberbat.bat -=-=-
HINT: you can change i=0 in the next file to any number that you wish
to start counting.
-=-=- BEGIN c:\parse.awk -=-=-
BEGIN {i=0}
{ i++
dest=c:\\Documents and settings\\Angharad Miller\\Local Settings\\webcam\\\\
print("copy \042" $0 "\042 \042" dest "webcam" i ".jpg\042")
}
-=-=- END parse.awk -=-=-=-

I am thinking that this will assist you for all files in all sub directories.
I *think* you'll like this.
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 15 Jun 2004 16:48 PDT
 
Oops, remove the REM before @echo off... It'll be less obnoxious.
Subject: Re: How can I paste multiple files with identical names in XP?
From: rexregum-ga on 16 Jun 2004 09:38 PDT
 
Hmm. I've saved the second file as c:\parse.awk and edited the
uberbat.bat as you directed, but I'm having a problem. dirlist.txt is
forming ok and lists all the files I want, but dothis.bat is always a
blank file.

Could you confirm exactly which folder I should put awk95.exe in? And
is it possible that it needs to be renamed to awk.exe instead of
awk95.exe?
I have a copy in c:\windows at present, which is named awk95.exe.

The -=-=-=- headers and footers seem to be different lengths for the
different versions posted; are they arbitrary?
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 16 Jun 2004 10:24 PDT
 
You wrote:
The -=-=-=- headers and footers seem to be different lengths for the
different versions posted; are they arbitrary?
-=-=-=-=--=-=-=--==

I use the -=-=-=- to separate chunks of data. Ideally (and I apologize
if this wasn't clear) you should merely select every line BETWEEEN the
-=-=-'s (That is, between the line that indicates BEGIN, and the line
that indicates END.) copy, and paste into the file mentioned at the
BEGIN tag.

the file parse.awk must be located at c:\ and ONLY look like:
BEGIN {i=0}
{ i++
dest=c:\\Documents and settings\\Angharad Miller\\Local Settings\\webcam\\\\
print("copy \042" $0 "\042 \042" dest "webcam" i ".jpg\042")
}

the uberbat.bat can be anywhere.
the awk95.exe can be anywhere in your path, but likely c:\windows is
as good a place as any.

As long as uberbat.bat uses awk95 as a filename, awk95 must exist.

If you included the -=-=-'s in the parse.awk, awk95 will balk :) hee
hee :) because awk95 doesn't understand what to do with the -=-=-'s.

Please understand, I've tested this so far and have been able to do
this with fairly positive success, so I don't want you to feel like
I'm using you as a test bunny. If any other commentors or Researchers
would like to try this and offer their results, I'd really appreciate
the feedback. I'd hate to continue with some flagrant error that I've
overlooked... Also, rexregum, you're getting an incredible deal (of
course, that will be your opinion) on this because I'm not a Google
Answers Researcher, so I can't receive payment for these comments and
revisions.

As far as I'm concerned, the best answer for Windows is to Find/Search
for Files in C:\Documents and Settings\Angharad Miller\Local
Settings\Temporary
Internet Folders\Content.IE5 that are named webcam*.jpg. 
Sort by name. 
Select all of the webcam.jpg 
Copy to destination folder.

create a new destination folder for webcam[1]'s
select all of the webcam[1].jpg's in your search results.
paste all of the webcam[1]'s into the destination folder for webcam[1]
Repeat the last three steps for each webcam[#] 

The reason is just so the automatic numbering of the multiple copy
doesn't interfere. That is to say, in the first webcam destination
folder, webcam.jpg will appear, then webcam[1].jpg will appear (it is
an automatic rename of webcam.jpg). We can't have all of the Internet
Files webcam[1]'s interfere with the webcam[1] that is created, so we
put the webcam[1]'s in their own directory.

At the point that you've pulled your hair out with my original
thoughts, processes, and schemes, why didn't I do this first? Because
um. well, the program *is* faster when it works. Your results may
vary.
Subject: Re: How can I paste multiple files with identical names in XP?
From: crythias-ga on 16 Jun 2004 10:25 PDT
 
HI 5 Pafalafa! I just wanted to give you kudos because we came up with
it at the same time. Take the money! Please!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy