Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VBA Code To Rename Files


Is there VBA code that runs from MS Word that renames filenames?

Thanks,




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Rename Files
Hi,

I have the following code:

Private Sub Command2_Click()

Directory = Dir1.Path

Set WSHFSO = New FileSystemObject

Set StartFolder = WSHFSO.GetFolder(Directory)

For Each File In StartFolder.Files
i = i + 1
File.Name = "Matt" & i.txt
Next

End Sub


How do I get it to rename the files such that they are matt1 matt2 matt3 etc

Thanks

How Do I Rename Files?
How do I go about renaming a file through VB ? I want to rename a file (unnamedsoldier.cfg) to another file name (snake.cfg) how would I do this?

Rename Files?
is there an api call to rename files? Iv played around using copyfile& and deletefile& but its not very fast. thanks people.

Rename Files
i am using the Copy File way to rename files:


Code:
Private Sub Command1_Click()

FileCopy PathFolder.Text & "FilesFile1.txt", pathfolder.text & "FilesFilesFile1.txt"

End Sub


And i am using this to browse to a folder:


Code:
Function BrowseFolder(Optional Caption As String, Optional InitialFolder As String) As String
'You need to set reference to Microsoft shell controls and automation
Dim SH As Shell32.Shell
Dim F As Shell32.folder
Set SH = New Shell32.Shell
Set F = SH.BrowseForFolder(0&, Caption, BIF_RETURNONLYFSDIRS, InitialFolder)
If Not F Is Nothing Then
BrowseFolder = F.Items.Item.Path
End If
End Function


And this is the browse button:


Code:
Private Sub cmdBrowsefolder_Click()
PathFolder.Text = BrowseFolder("Select Your Folder", "My Computer")
End Sub


and this to make a folder;


Code:
Private Sub Command1_Click()

MkDir "c:
ew Map"

End Sub



ok. I had this idea:
1} You select a folder of your choise
2} Get ALL the files of that folder
3} Make a new folder in the selected folder
4} RENAME the files by adding text from Text1.text

So if we have folder with this files:
MyFile.txt
MyMusic.txt
MyImages.txt
Myfavourites.txt

And in Text1.text we have : "111"

So there must be a new folder created in folder
And copy the files with a new name to it:

MyFile11.txt
MyMusic11.txt
MyImages11.txt
Myfavourites11.txt

My problem is this part:
2} Get ALL the files of that folder
4} RENAME the files by adding text from Text1.text

How to get the original file names, and rename them by adding text from text1.text

Thank you

Name As To Rename Files
I'm a little new to VB and am mostly self-taught, as such my code is probably very inefficient and not done properly: Anyway, to my question, can someone tell me why the following code tells me that the "Name" line gives an Invalid procedure call or argument (Error 5). If I write a test code which does essentially the same thing (without all the search and automation) it works fine... why does the same command in two contexts not work the same?

Code that won't work:

VB Code:
Sub PicRename()     Dim day As String    day = InputBox("Please enter the folder name as it appears in my pics")    Dim hour As Integer    hour = InputBox("Please enter the latest hour (after midnight - on a 24h clock) for pictures to be converted")    Dim num As Integer    num = 0    Dim newnum As Integer    Dim changer As String    Dim newnam As String  alpha:    newnum = num + 24    With Application.FileSearch        .FileName = "0" & num & "????AA.JPG"        .LookIn = "C:Documents and SettingsPCPCMy DocumentsMy Pictures" & day & ""        .Execute        If .FoundFiles.Count = 0 Then GoTo Omega        For i = 1 To 1            changer = .FoundFiles(i)            With Selection                .TypeText (changer)                .MoveLeft unit:=wdCharacter, Count:=10, Extend:=wdMove                .MoveLeft unit:=wdCharacter, Count:=2, Extend:=wdExtend                .TypeText (newnum)                .HomeKey unit:=wdStory, Extend:=wdMove                .EndKey unit:=wdStory, Extend:=wdExtend                newnam = .Text                .Delete            End With        Next i    End With'line that doesn't work:    Name changer As newnam GoTo alpha:Omega:    If num < hour Then        num = num + 1        GoTo alpha:    End If   End Sub


Code that does work:

VB Code:
Sub Test() Dim changer As StringDim newnam As Stringchanger = "C:Documents and SettingsPCPCMy DocumentsMy Pictures2005_122405206AA.JPG"newnam = "C:Documents and SettingsPCPCMy DocumentsMy Pictures2005_1224245206AA.JPG" Name changer As newnam End Sub


If anyone could help me figure this out it would be greatly appreciated.

Rename Files
Hi All,
I have been working on this small VB project (attached as a zip file) which does the following:
1. Scans the file name of all the files in a folder/sub-folder.
2. If the file name is more than 5 characters long, it lists the file in a list box.

I wish to modify the project so that it can do the following:
1. Append _c at the end of the file. e.g. lonely.doc will become lonely_c.doc
2. Add a feature to the list box given in the code so that I can rename the file from the application itself.

Please can someone help me modify the code so that it can perform the above functions?

Thanks,
Lonely

Rename Files
How do I check a file's size then rename the file's name?

.:: Phear Factory ::.

Can You Rename Files In Vb?
is there any statement that i can use in vb code that will allow me to change filenames on my computer? i want to make an exe and then run it to change filenames on my computer but i dont really know where to start! i am totaly new to visual basic and need some help really bad! thanks

Rename Files With VB
I have 100's of files to rename.
I have a list of all Old file names. Using a variable, I can make a string for the New file name, from that list.
I am confident VB would let my computer do the work more efficiently that a person could. But I am not sure how.

I am not a VB expert, but can learn quickly.
Thank you in advance for help.

I Need To Rename Files!!!
I have been screwing with this for a while now, and I swear I must be retarded.

I need to rename a file (inventory.xls) to (inventory.bak).

How do I do this within code?

Thanks for any help... I don't think this is a difficult question, but I can't find this answer anywhere.

thanks

Shawn

Rename Files
Is it possible to rename all the .jpg files in a folder... The new name should be continues, 1, 2, 3, 4...

ex: (how do I get the new name?)
old name new name
text001.jpg 1.jpg
text003.jpg 2.jpg
text007.jpg 3.jpg
text009.jpg 4.jpg
text015.jpg 5.jpg
text016.jpg 6.jpg

any ideas?


thanks

Rename Files
Is there an easy way of renaming files that contain a certain word... I have 100 files named ####ab-short.htm

I would like to remove the "-short" from all the files' names. the # is an unique number...

thanks

Rename Files
I am looking to rename files... i noticed in some posts people using a "name" function... do you have to set a reference to use that?

Rename Txt Files
I have 2 files in my C: Dir called:
ActiveLog.txt and
ActiveLog.old

How do i rename the file ActiveLog.txt to ActiveLog.old overwriting the original?

i will eventually put this code in a timer control so that is executes this function once every month.

I will then need to create a new ActiveLog.txt file.

Hope you understand the Q

thanx

Rename Files
i 've much mp3's with underscores in the filenames, i want to change them in spaces with a vb-program.
i can get the filenames into strings, but how can i change the strings?

Rename Files
Hi

I have a ListBox with possible new filenames, say 10 items
and if I at the same time have a FileList with 10 files,
can I rename all the 10 files with the names I have in the List box in one single action.

The filenames has to be called 01-10.filename, so the app knows what it is looking for.

I have tried with For loops but I havent gotten any near it.

Hope you can help

Thanks


Best regrads,

Chris Davidsen

I Need To Rename A Lot Of Files
I need to know how I can rename files.
Thats all, very simple you would think.

Rename Some Files
Hello!
I'm making a demo save utility
for Action Quake 2 and I would
like to know how to rename files
with VB. Like this:
Original name: demo1.dm2
The new name : cooldemo1.dm2
hope you can help / rotor@home.se

I Want To Rename Files!
how can i rename multi files at once????????

Rename Files, Delete Files
Hi

I am relatively new to VB, but I have written a program than generates a report, I won't get into all the details, it's actually for an assignment for this course, but anyways, I have made it so that the report gets generated into a temp file. Then I want to give an option (probably in the form of a button) to either save the file, or discard.

For the save, I suppose I could either rename the tmp file and move it to the save location, or copy the contents of the tmp file into the filename specified by the end user and then delete the temp file.

I don't know the code for any of the possibilities mentioned in the previous paragraph, if someone could help me out with the code it would be much appreciated.

Thanks

Rename Files In Order
I need to find a macro that will either open files and rename them or just rename them. The important part is for the program to rename the files in the same order that they appear in windows explorer. The new name of the file will go in order like this a001, a002, a003, a004... all the way up to 300.

How To Rename A Bunch Of Files?
i searched filescriptingobject on msdn library but there was no sign of renaming a file. but i saw copy move del, etc.... a file.
anyone know how to rename?
thanks

Rename Files And Move
hi,

i have a problem. i want to rename all files in a specific folder.
I don't know how to do this.
I want to change them like this:

all files end with .mp3
i want to rename all files like this:

*.mp3 --> *v.mp3

Can anyone help me??

thanks alot

akim123

How To Rename Files And Copy Them Into New Dir
Hello i got more files and i first want to rename then copy them to the other map(renamed files).

And that files r w/o extension. So they r just files.


So in fact i wanna like that (dont forget there is a lot of files)




im coding in vb6

Rename Files Of Folder
Hi,

I want to rename all files of a folder.
Pls help me.

------
Manish

Rename All Files With Certain Extention
Can somebody help me out with this? I'm trying to rename all files in a certain folder that have a certian extention to another extension. Any help is appreciated, thanks

Rename Files With Wildcard VB6
I am a very amatuer VB programmer, so bare with me. Here's what I'm looking to do. I have 3 files that get saved into a directory every day. The first part of the file names are the same every day, but the name also contains a date stamp that changes. I need to rename each file to a different name REGARDLESS of the date stamp in the name. Thus the need for some type of wildcard. Also, the files are to be renamed the exact same thing every day, so I just want to create a button that executes this upon click. I also need to check if the file exist first and then delete it before renaming the other file.

Basic Code

If FileExist (C: estmyfile.txt) Then
Delete File
End If

If FileExist (C: estold_file_*.txt) Then
Name old_file_*.txt As myfile.txt
Else
msg "File not found"
End If

I would then do the same thing for myfile2 and myfile3.

I understand that this is a very basic example of what I need to do, but hopefully someone can enlighten me on how to accomplish this. Everything I've tried has crased and burned. Thanks!

Rename Directory && Files
I have a directory with this name 1010001.imp, the directory contents files in this format : f001.tif.imp.
How would I rename the directory from 1010001.imp to 1010001 and all the contents from f001.tif.imp to f001.tif?
Now I do this from dos (ren *.imp *.tif).
I really need a code example to rename directory and contents in one press button.

Thanks in advance!
Andy

Rename Files???*RESOLVED*
Id there a fairly easy way to rename a file, if you know its current name, path and extension???

Thanks in advance.

Copy/rename Files
How do I copy a file to a different folder and rename it?

Rename Disc Files
I need to provide a means by which groups of files can be renamed using a VB project in the same way that I can perform this fuction using 'ren' and the '?' wildcard at the command prompt.

I have tried using the 'Name' statement in the code for a command button which works great for renaming one file but I dont seem to be able to use a wild card to change a group of files.

Does anyone know the answer to this problem please.
PS I am new to VB, please keep the answers simple.

Rename Files In A Folder
How would change a list of files in a folder. I need to add prev. biz to the files.

i.e.

the files look like this:
invoice_.xls

they need to look like this:
invoice_(5-23-2001).xls

Thanks for any help.....

Delete And Rename Files...
How can I delete files from VB and renameing them.
To be more specific, I need to know how to delete and rename selectes files from a Filelistbox, not just one file, but all the highlighted files.

Thanks...

How To Delete && Rename Files?
Hi everybody,

I am compacting a database file and need to delete the old file and rename the new one. Can anyone help me with the VB code/syntax used to rename & delete files? Your help is appreciated.

Delete And Rename Files In VB
Yes I was wondering how to delete and rename files in VB???
if anyone could lend a hand????

Automatically Rename Files
Hello,Is it possible to write a script that will automatically rename files ( with certain extensions ) in a specific format, as soon as they are saved in a specific folder.I'm new to writing shell scripts, VB and DOS scripts, and any help will be greatly appreciated.Thanks

Search And Rename Files
Hi there,

I've search around this section for the search type I've been looking for but couldn't find it.

I know it's something 'bout using FileSystemObject but what I need is to search for files starting with ERROR__*.*
and not a *.EXE or anything.

How would I go about doing so? And any direction on renaming it as well?

Thanks!

How To Rename External Files
Hi,

I am new to this group and a novice (returning) VBA programmer. I have a project I am working on that requires using a "blank.mp3" file residing in a folder and creating copies of it with the names coming from a column in a worksheet. I have seen and used some of the file features of the VBA. Is there a smarter way to do this as opposed to find the file and copy with a different name? How would I change one or any of its advanced properties? I know how to find them using GetMP3TagInfo - but how do we set those tags?

Thanks very much for any advice or pointer to any resource.

Ghassem

Remove, Rename Files ?
Hello all,
to remove/delete file must use : Delete file_name ? wright ?
and now, i can rename file(i have 2 files, delete first, rename second to first) ??

THANKS for your help

How To Rename Files In Groups?
Hi,
I'd like to create a tiny batch file or .exe in VB6 or VB.NET that would allow me to highlight 4 files in windows explorer and rename them but I don't know where to begin. Mabe add a hotkey that would run the program/file on the files selected etc.
The files will always be named in the same order.

I'd like to use different car names, yet always using the same four " -interior.jpg" , " -exterior.jpg" etc, such as:
 
car1-interior.jpg
car1-exterior.jpg
car1-front.jpg
car1-back.jpg

I've found one like what I am describing at http://www.publicspace.net/windows/BetterFileRename/
but it doesn't change the suffix for each file as it renames them.

Thanks for any assistance



Edited by - Matrix1000 on 8/8/2003 11:51:50 AM

Can You Rename Files With A Button?
I need to know how to rename several files by clicking a button.

This is really important that I can do this soon.

Thanx.

VBA, What Functions Do I Use To Rename Files?
Hi All,

Hope everybody had a nice easter. This is the problem:
I have many many filenames in a folder. About half of them have 9:3 filenames (like 123456789.jpg) and the other half has 8:3 filenames (like 12345678.jpg).
I want the 8:3 filenames to become 9:3 filenames, I want to put a zero in front of all the 8:3 filenames to accomplish this.

Now here is the question, what functions do I use to accomplish this? Dir, Name, As, FileListBox? It would be awsome if someone has done this bedore and can post his findings here?

Maybe it's possible with a couple of dos commands? If someone knows how to select 8:3 files that would be great also.

Best regards,

Jasper

Rename Registry Key Using Code
Can anyone tell me how to use this code to rename a registry key using the code below (by Aarron Young)
Like rename: HKEY_LOCAL_MACHINE > SoftwarePolicies
to : HKEY_LOCAL_MACHINE > SoftwarePolicy
Thanks in advance


Code:
Option Explicit
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As Any, phkResult As Long, lpdwDisposition As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long
Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long
Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.

Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_CONFIG = &H80000005
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_DYN_DATA = &H80000006
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_PERFORMANCE_DATA = &H80000004
Private Const HKEY_USERS = &H80000003


Private Const KEY_CREATE_LINK = &H20
Private Const KEY_CREATE_SUB_KEY = &H4
Private Const KEY_ENUMERATE_SUB_KEYS = &H8
Private Const KEY_EVENT = &H1
Private Const KEY_NOTIFY = &H10
Private Const KEY_QUERY_VALUE = &H1
Private Const KEY_SET_VALUE = &H2
Private Const SYNCHRONIZE = &H100000
Private Const STANDARD_RIGHTS_ALL = &H1F0000
Private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))

Private Const REG_CREATED_NEW_KEY = &H1

Private lNewKey As Long
Public Sub RenameRegKey(ByVal sRegKey As String, ByVal sNewName As String, Optional ByVal lHive As Long = HKEY_LOCAL_MACHINE)
Dim lRegKey As Long
Dim lResult As Long

'Create the new Base Registry Key and get the handle to the existing one
lNewKey = 0
If RegOpenKeyEx(lHive, sRegKey, 0&, KEY_ALL_ACCESS, lRegKey) Then Exit Sub
If RegCreateKeyEx(lHive, Left(sRegKey, InStrRev(sRegKey, "")) & sNewName, 0, "", 0, KEY_ALL_ACCESS, ByVal 0&, lNewKey, lResult) Or (lResult <> REG_CREATED_NEW_KEY) Then
Call RegCloseKey(lRegKey)
Exit Sub
End If

'Copy all Keys in the Original Key structure to the New Key
DuplicateKeys lRegKey, lNewKey

'Close Both the Old and New Keys
Call RegCloseKey(lRegKey)
Call RegCloseKey(lNewKey)

'Delete the Old Key
Call RegDeleteKey(lHive, sRegKey)
End Sub

Private Sub DuplicateKeys(ByVal lKey As Long, ByVal lKeyCopy As Long)
Dim lIndex As Long, lSubKey As Long, lSubKeyCopy As Long, lResult As Long
Dim sName As String, sClass As String
Dim tFILETIME As FILETIME

'Enumerate all SubKeys of the specified Key
sName = Space(255): sClass = Space(255)
lIndex = 0
While RegEnumKeyEx(lKey, lIndex, sName, 255, 0, sClass, 255, tFILETIME) = 0
sName = Left(sName, InStr(sName, Chr(0)) - 1)
If InStr(sClass, Chr(0)) Then
sClass = Left(sClass, InStr(sClass, Chr(0)) - 1)
End If
'Create a copy of this Subkey
If RegCreateKeyEx(lKeyCopy, sName, 0, sClass, 0, KEY_ALL_ACCESS, ByVal 0&, lSubKeyCopy, 0) = 0 Then
If RegOpenKeyEx(lKey, sName, 0, KEY_ALL_ACCESS, lSubKey) = 0 Then
'If there are SubKeys to this Key, Copy them too
Call DuplicateKeys(lSubKey, lSubKeyCopy)
'Copy all Values in this Key
Call DuplicateValues(lSubKey, lSubKeyCopy)
'Close this Key, then delete the original
Call RegCloseKey(lSubKey)
Call RegDeleteKey(lKey, sName)
End If
Call RegCloseKey(lSubKeyCopy)
End If
sName = Space(255): sClass = Space(255)
Wend
End Sub

Private Sub DuplicateValues(ByVal lKey As Long, ByVal lKeyCopy As Long)
Dim lIndex As Long, lLen As Long, lType As Long
Dim sName As String, aData() As Byte

'Enumerate all values for the specified key
sName = Space(255)
lIndex = 0
While RegEnumValue(lKey, lIndex, sName, 255, 0&, lType, ByVal 0&, lLen) = 0
ReDim aData(lLen - 1)
Call RegEnumValue(lKey, lIndex, sName, 255, 0&, lType, aData(0), lLen)
sName = Left(sName, InStr(sName, Chr(0)) - 1)
'Copy the value to the new Key structure
Call RegSetValueEx(lKeyCopy, sName, 0&, lType, aData(0), lLen)
sName = Space(255)
lIndex = lIndex + 1
Wend
End Sub

Rename Files In Folder From Csv File
I have some code which reads the contents of a .csv file into an array (which works fine). I also have some code which renames files in a given folder which works.

I need to read in the first field in the array (which will be the name of a .pdf file such as “001234.pdf”.) I then need to search a given folder for the filename that corresponds and rename that file to the second field in the array such as “336998.pdf” and then loop through each of the records in the array.

For example

Array line 1 = “001234.pdf”, “336998.pdf”, “Version 1”, “Backplate”
Array line 2 = “001423.pdf”, “335776.pdf”, “Version 2”, “Cover”
Array line 3 = “001256.pdf”, “332568.pdf”, “Version 1”, “Harness”
Etc

I want to read the “001234.pdf” from the array, then look in the folder for that file and rename it to “336998_Version1.pdf” and then move to the next line to read “001423.pdf” and rename that to “335776_Version2.pdf”, etc. I don’t need the descriptions included “Backplate”, etc.

Here’s my code so far


Code:
Private Sub CmdRenameFiles_Click()
On Error Resume Next
Dim file_name As String
Dim fnum As Integer
Dim whole_file As String
Dim lines As Variant
Dim one_line As Variant
Dim num_rows As Long
Dim num_cols As Long
Dim the_array() As String
Dim R As Long
Dim C As Long

file_name = varStartFile
' Load the file.
fnum = FreeFile
Open file_name For Input As fnum
whole_file = Input$(LOF(fnum), #fnum)
Close fnum

' Break the file into lines.
lines = Split(whole_file, vbCrLf)

' Dimension the array.
num_rows = UBound(lines)
one_line = Split(lines(0), ",")
num_cols = UBound(one_line)
ReDim the_array(num_rows, num_cols)

' Copy the data into the array.
For R = 0 To num_rows
one_line = Split(lines(R), ",")
For C = 0 To num_cols
the_array(R, C) = one_line(C)
Next C
Next R

' Prove we have the data loaded.
For R = 0 To num_rows
For C = 0 To num_cols
Debug.Print the_array(R, C) & "|";
Next C
Debug.Print
Next R
End Sub

Code:
Public Sub RenameFile() 'routine to take old sales.txt filename and rename it with "error" text
On Error GoTo RenameError

Dim from_str As String
Dim to_str As String
Dim dir_path As String
Dim old_name As String
Dim new_name As String

dir_path = "C:TEMP"

from_str = ""
to_str = ""

If Right$(dir_path, 1) <> "" Then dir_path = dir_path & "" 'make sure string is ended with a "" to denote a folder and not a file

old_name = Dir$(dir_path & from_str, vbNormal) 'original filename

Do While Len(old_name) > 0
new_name = Replace$(old_name, from_str, to_str) 'rename the file
If new_name <> old_name Then 'if the new name differs from the old name then...
Name dir_path & old_name As dir_path & new_name 'convert the name to the new one
NewFileName = dir_path & new_name 'add the path to the new name string
NewFileOnly = new_name 'new_name is the changed name!
End If
Loop

Exit Sub

RenameError:
'MsgBox Err.Number & " " & Err.Description, vbCritical, "File Rename Error"
Exit Sub
End Sub
I’m not sure how to access elements of the array and then search a folder for the same file and rename them.

Any ideas would be appreciated.

Select Files From Filelistbox And Rename Them.
I am trying to rename a list of files from a selected folder via:

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Once I have the folder selected, I can see the files in the filelistbox. Since I am very new at VB, I am having a hard time understanding how to read each file (starting with the first and ending with the last) then renaming it. I have searched through the forums and found code that is very similar to what I want to do but I am having trouble putting it all together. I know that I need to put together some sort of EOF function. This should allow me to go through each file. As I go through each file I want to rename the file to its last modified date (using FileDateTime).

I have a bunch of code that I have tried to piece together from other questions, but it is not worth posting it because it does not do anything productive.

If nothing else, can someone explain to me how to use the File1.path and rename a file.

Thanks for the help

Rename Files By Getting Names From File
Hey, I'm only 15 and a complete rookie at programming. However i would like to create a program that could copy all my songs on my ipod to my computer. Which should be easy enough. The part that is really getting me is how to rename them from "HFKCU.m4a" etc. to their original names. These names are stored in a database file on the ipod. How would i get access to the original names and rename the music files to that? Thanks in advance!!

Rename Files In File Listbox
How do I rename files I placed into a file listbox. The new file name will be entered in a text box. I also want the files to be sequential (myFilex, myFilexx, myFilexxx, etc) if the file exists then continue the numbering scheme.

Copyright © 2005-08 www.BigResource.com, All rights reserved