By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Get a file name path from a text file

P: 1
Hello All,

I have an exportfile .txt from robocopy utility and I would need to get file name path from the file and save it to file1.txt
after get the filename value and save it to file2.txt

example of the export is:

c:\test\test.txt
D:\test\test.txt
..

I need to get "c:\test\" and save to file1.txt
then to get test.txt save to file2.txt

is it possible somehow by VBS ?

Thank you
Jan 16 '08 #1
Share this Question
Share on Google+
3 Replies


P: 4
Not sure i understand what you need, but if you just need to copy the file it's;

File.Copy(SourceFileName, DestinationFileName)

eg:

File.Copy("c:\test\test.txt", "c:\test1\test.txt")

Or if you want to overwrite:

File.Copy("c:\test\test.txt", "c:\test1\test.txt", True)
Jan 24 '08 #2

Ali Rizwan
100+
P: 927
You can use file copy command but if you want to make some changes to the path then you need to use FSO.

Regards
>> ALI <<
Jan 27 '08 #3

Expert 5K+
P: 8,434
The simplest method is probably to use a loop and the Mid() function to check each character starting at the end of the string, until you hit a backslash. That's the end of your path, and the character after is the start of your filename.
Jan 28 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.