Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a program to print the current folder name in the local system.
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi can anyone answer my question quickly please.


Question:

Write a program to print the current folder name in the local system.
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi, It will give you the path of a folder

Code:
dim f,fso

set fso=createobject("scripting.filesystemobject")

set f=fso.getfolder("E:\Baba_QTP\QTP\Scripts")

msgbox f
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Kannan,

In addition to Baba's solution, You can try in the below way for Printing the required FolderName in QuickTest Print Log.

Code:
Dim f,fso
set fso=createobject("scripting.filesystemobject")
set f=fso.getfolder("C:\Documents and Settings\csreekanth\Desktop\Srirama-ELC")
Print f.Name
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
use inbuilt environment variable
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

Here is the code to get the only folder name not all the path of a folder.

Code:

Code:
dim f,fso

set fso=createobject("scripting.filesystemobject")

set f=fso.getfolder("E:\Baba_QTP\QTP\Scripts")

msgbox "Path of the Folder      :     "&f

ext=split(f,"\")

msgbox "Exact Folder Name    :   "&Exact

Function Exact()

for i=0 to ubound(ext)

Exact=ext(i)

Next

End Function
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
@D.Baba Fakruddin - The query was to get the current folder name which can be retrieved by environment variable suggested by azar80.
what you are doing is just parsing the path string which is required to be passed, right?

Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hello Saket,

Thanks for your advice. I think you do understand the question, Question is to write a script to get a Stored Folder Name. as per azar80 comments one line script. I don't think that is exact answer for this question. Any how, Ask for a question to Kannan_Paneersalvam once again and provide your valuable Answer. I am waiting for that.

I know only the above way to get a Folder Name. If you have any other way to get Folder Name other than above two ways. Please let me know.

Thanks & regards,
Baba Fakruddin.D
Reply
#8
Solved: 11 Years, 3 Months, 3 Weeks ago
I think this may help you

Code:
set WshShell = WScript.CreateObject("WScript.Shell")
Dir=WshShell.CurrentDirectory
arrydir=split(dir,"\")
msgbox arrydir(ubound(arrydir))

Thanks
Gowtham
Reply
#9
Solved: 11 Years, 3 Months, 3 Weeks ago
Well i have seen that commentators are arguing with their answer....actually the question is not clear.....

what exactly u want????

1. The current folder name only where you are present???
2. Or u need the full path of that folder where you are present???

The answer of 1st question is what exactly gowtham.m.h has suggested.....

and the answer of 2nd question is to use inbuilt Environment variable ("TestDir") what exactly azar80 has suggested.....

And i dont think bfakruddin has suggested any logical answer...he has just passed the string and printed that....but if i dnt know the string then what??? i guess exactly this thing is being asked in this question that how to get that string.......


So better try gowtham.m.h or azar80 suggestion as per ur need.....

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  System Utility Syntax chita26 1 4,925 11-04-2014, 12:41 PM
Last Post: vinod123
  Error in getting sum of numbers program QTpier 2 3,029 07-18-2014, 01:53 PM
Last Post: QTpier
  Delete icon in System tray arpan 2 4,064 07-12-2013, 07:38 PM
Last Post: arpan
  Creating a folder from within a reusable action. sd3 2 3,186 06-18-2013, 03:20 PM
Last Post: learnQtptips
Exclamation How to get the system time using QTP qtplearner88 1 11,851 05-30-2012, 05:42 PM
Last Post: ssvali

Forum Jump:


Users browsing this thread: 1 Guest(s)