- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Microsoft
- >
- Re: change name while copying a file in vbs
Operating System - Microsoft
1748051
Members
4871
Online
108758
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-17-2008 05:49 AM
тАО03-17-2008 05:49 AM
change name while copying a file in vbs
hi all,
i have the following script,
and I want to change the name of destination file to
something.txt,
how to do it?
N=Now
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder="L:\"
strNewDest = "Q:\"
Set objFolder = objFSO.GetFolder(strFolder)
For Each strFiles In objFolder.Files
If DateDiff("d",N, strFiles.DateLastModified) = -1 Then
objFSO.CopyFile strFiles , strNewDest & "\" & strFiles.Name
End If
Next
thanks
i have the following script,
and I want to change the name of destination file to
something.txt,
how to do it?
N=Now
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder="L:\"
strNewDest = "Q:\"
Set objFolder = objFSO.GetFolder(strFolder)
For Each strFiles In objFolder.Files
If DateDiff("d",N, strFiles.DateLastModified) = -1 Then
objFSO.CopyFile strFiles , strNewDest & "\" & strFiles.Name
End If
Next
thanks
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2008 03:17 AM
тАО03-18-2008 03:17 AM
Re: change name while copying a file in vbs
kabucek,
Using .MoveFile, you can specify the new name as shown below:
objFSO.MoveFile "C:\myFileName.txt" , "C:\myNewFileName.txt"
Using .MoveFile, you can specify the new name as shown below:
objFSO.MoveFile "C:\myFileName.txt" , "C:\myNewFileName.txt"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2008 06:05 AM
тАО03-18-2008 06:05 AM
Re: change name while copying a file in vbs
but these files are ntbackup reports and the name changes periodically.
i want to catch "NewestFile" and copy that file.
thanks
i want to catch "NewestFile" and copy that file.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2008 06:17 AM
тАО03-18-2008 06:17 AM
Re: change name while copying a file in vbs
Instead of using strFiles.Name for the destination, simply place in your new file name. For example:
objFSO.CopyFile strFiles , strNewDest & "\" & something.txt
If there are multiple ones, you could also just try adding the new extension:
objFSO.CopyFile strFiles , strNewDest & "\" & strFiles.Name & ".txt"
objFSO.CopyFile strFiles , strNewDest & "\" & something.txt
If there are multiple ones, you could also just try adding the new extension:
objFSO.CopyFile strFiles , strNewDest & "\" & strFiles.Name & ".txt"
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP