Re: Using VB to rename and move files ?
- From: "Stephen.B" <Sorry@xxxxxxxxxxxxx>
- Date: Sun, 3 Jul 2005 13:17:10 +0000 (UTC)
Thanks very much for your assistance Ron, I shall have a go at this and let
you know how i get on.
Steve.
"Ron" <roduku@xxxxxxxxxxx> wrote in message
news:1120333423.404548.283010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi, Steven.B
>
> Here are a few things I got from my copy of MSDN. You can use the
> online reference at: http://msdn.microsoft.com/library/default.asp
>
>
> Name Statement
>
>
> Renames a disk file, directory, or folder.
>
> Syntax
>
> Name oldpathname As newpathname
>
> The Name statement syntax has these parts:
>
> Part Description
> oldpathname Required.String expression that specifies the existing file
> name and location - may include directory or folder, and drive.
> newpathname Required. String expression that specifies the new file
> name and location - may include directory or folder, and drive. The
> file name specified by newpathname can't already exist.
>
>
> Remarks
>
> The Name statement renames a file and moves it to a different directory
> or folder, if necessary. Name can move a file across drives, but it can
> only rename an existing directory or folder when both newpathname and
> oldpathname are located on the same drive. Name cannot create a new
> file, directory, or folder.
>
> Using Name on an open file produces an error. You must close an open
> file before renaming it. Namearguments cannot include
> multiple-character (*) and single-character (?) wildcards.
>
>
> Name Statement Example
>
> This example uses the Name statement to rename a file. For purposes of
> this example, assume that the directories or folders that are specified
> already exist.
>
> Dim OldName, NewName
> OldName = "OLDFILE": NewName = "NEWFILE" ' Define file names.
> Name OldName As NewName ' Rename file.
>
> OldName = "C:\MYDIR\OLDFILE": NewName = "C:\YOURDIR\NEWFILE"
> Name OldName As NewName ' Move and rename file.
>
>
>
>
> SubFolders Property
>
>
> Description
>
> Returns a Folders collection consisting of all folders contained in a
> specified folder, including those with Hidden and System file
> attributes set.
>
> Syntax
>
> object.SubFolders
>
> The object is always a Folder object.
>
> Remarks
>
> The following code illustrates the use of the SubFolders property:
>
> Sub ShowFolderList(folderspec)
> Dim fs, f, f1, s, sf
> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.GetFolder(folderspec)
> Set sf = f.SubFolders
> For Each f1 in sf
> s = s & f1.name
> s = s & vbCrLf
> Next
> MsgBox s
> End Sub
>
>
>
>
>
>
>
> Kill Statement
>
>
> Deletes files from a disk.
>
> Syntax
>
> Kill pathname
>
> The required pathnameargument is astring expression that specifies one
> or more file names to be deleted. The pathname may include the
> directory or folder, and the drive.
>
> Remarks
>
> In Microsoft Windows, Kill supports the use of multiple-character (*)
> and single-character (?) wildcards to specify multiple files
>
>
> Kill Statement Example
>
> This example uses the Kill statement to delete a file from a disk.
>
> ' Assume TESTFILE is a file containing some data.
> Kill "TestFile" ' Delete file.
>
> ' Delete all *.TXT files in current directory.
> Kill "*.TXT"
>
>
> I hope this is helpful...if you have anything else, post it here and
> I'll see what I can do.
>
.
- References:
- Using VB to rename and move files ?
- From: Stephen.B
- Re: Using VB to rename and move files ?
- From: Ron
- Using VB to rename and move files ?
- Prev by Date: Re: Inet1.OpenURL
- Next by Date: Re: Using VB to rename and move files ?
- Previous by thread: Re: Using VB to rename and move files ?
- Next by thread: Re: Using VB to rename and move files ?
- Index(es):
Relevant Pages
|