coolguy2009
asked on
image help needed
Hi,
I have a image files in directory"c:/images"
The file names are 1.jpg,2.jpg,atc.jpg etc...
I need a way to rename all the files inside the folder to thumb_1.jpg,thumb_2.jpg,th umb_atc.jp g etc...
Any help...
I have a image files in directory"c:/images"
The file names are 1.jpg,2.jpg,atc.jpg etc...
I need a way to rename all the files inside the folder to thumb_1.jpg,thumb_2.jpg,th
Any help...
ASKER
Hi,
That is the one he want to remove the words...But i need to append a word thumb_
That is not a solution i am expected..
That is the one he want to remove the words...But i need to append a word thumb_
That is not a solution i am expected..
ASKER
Can anyone help me on this?
Try this
Ritesh
Ritesh
Sub renall()
Dim sPath, sFile, mFile, oFile As String
sPath = "D:\desktop\ee\"
sFile = Dir(sPath & "*.jpg")
Do While sFile <> ""
oFile = sPath & sFile
nfile = sPath & "thumb_" & sFile
Name oFile As nfile
sFile = Dir
Loop
End Sub
Please change sPath, Serach Path to your directory
Ritesh
Ritesh
ASKER
I tried this nothing happens...
I saved this code in excel by alt f11 amd then i run alt f8...
Where i went wrong?What i did is correct?
Please advice...
I saved this code in excel by alt f11 amd then i run alt f8...
Where i went wrong?What i did is correct?
Please advice...
Sub renall()
Dim sPath, sFile, mFile, oFile As String
sPath = "G:\thumb_images"
sFile = Dir(sPath & "*.jpg")
Do While sFile <> ""
oFile = sPath & sFile
nfile = sPath & "thumb_" & sFile
Name oFile As nfile
sFile = Dir
Loop
End Sub
ASKER
ASKER
I also change ur code?This also not renamed my files...
Sub renall()
Dim sPath, sFile, mFile, oFile As String
sPath = "G:\thumb_images"
sFile = Dir(sPath & "*.jpg")
Do While sFile <> ""
oFile = sPath & sFile
mFile = sPath & "thumb_" & sFile
Name oFile As mFile
sFile = Dir
Loop
End Sub
G:\thumb_images
Just put a back slash at hte end of it
G:\thumb_images\
and retry
Ritesh
Just put a back slash at hte end of it
G:\thumb_images\
and retry
Ritesh
ASKER
I tried this..
File not found...
File not found...
Sub renall()
Dim sPath, sFile, mFile, oFile As String
sPath = "G:\thumb_images\"
sFile = Dir(sPath & "*.jpg")
Do While sFile <> ""
oFile = sPath & sFile
mFile = sPath & "thumb_" & sFile
Name oFile As mFile
sFile = Dir
Loop
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops - please ignore my last comment - someone has already trapped that error.
Patrick
Patrick
https://www.experts-exchange.com/questions/24142878/How-To-Rename-Multiple-Files.html