Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replace file name script

Status
Not open for further replies.

bk89

Technical User
Jun 26, 2007
8
US
I have a list of jpg files such as:

1.jpg
2.jpg
3.jpg

etc.

I want to replace ALL of these jpg files with defaultimage.jpg but I want the files to still be named 1.jpg, 2.jpg, and 3.jpg etc. All that is changing is the contents of each file will now be defaultimage.jpg but still named the original name.

Does anyone have a script that does this?
 
There have been many posts about renaming files. Just search the fora.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I have searched. None deal with replacing an image with its original file name still in tact.
 
They do, you just need to take the time to understand what they are doing. What have you written so far?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Well, to be honest with you what you need to be looking for is code that deals with copying files not renaming because here is the pseudo code for what you want to do if I understand the question:

For each file name in a list
Copy DefaultImage.jpg to File name overwriting the current contents

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top