Poll: is this program good
You do not have permission to vote in this poll.
yes most defently
100.00%
1 100.00%
its ok
0%
0 0%
it stinks
0%
0 0%
Total 1 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
search program
#11
[/code]
cls

print "the results will be in search.txt"
print "made by everett gillert"
print "email everett.gillert@gmail.com"
input "drive"; d$
input "dir"; s$
input "file type"; f$
input "name"; n$
if s$ = "\" then
goto sub1
else
if s$ = "" then
goto sub1
else
if s$ = " " then
goto sub1
else
shell "dir "+d$+":\"+s$+"\"+n$+"."+f$+"/b/a-d>search.txt
end
sub1:
shell "dir "+d$+":\"+n$+"."+f$+"/b/a-d>search.txt
return

[/code]
Reply
#12
Quote:
Code:
cls
print "to work create a folder called search in the folder you put this"
print "program in"
print "the results will be in search\search.txt"
print "made by everett gillert"
print "email everett.gillert@gmail.com"
input "drive"; d$
input "dir"; s$
input "file type"; f$
input "name"; n$
shell "dir d$:\s$n$f$/b > \search\search.txt"
end


maybe it should be shell "dir d$:\s$\n$.f$/b > \search\search.txt"
y name is Nobody, and nobody's perfect. So now I am perfect Tongue

98% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
Reply
#13
i thout to do that but i thout pepole would know to do .bas or what ever they where looking for and i missed that dir one
Reply
#14
you messed up somewhere. I tried that and got the same file creation error
y name is Nobody, and nobody's perfect. So now I am perfect Tongue

98% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
Reply
#15
dir \search\search.txt
mabey
or just search.txt
Reply
#16
tannervp, BTW your program is a nice frontend for searching files using the DIR command. Sorry, but I thought you had written an entire utility to do this.

Quote:
everett Wrote:
Code:
.....
input "drive"; d$
input "dir"; s$
input "file type"; f$
input "name"; n$
shell "dir d$:\s$n$f$/b > \search\search.txt"
end
maybe it should be shell "dir d$:\s$\n$.f$/b >\search\search.txt"
You got the right idea, except for the way you build the SHELL command string. Take a look at this:

shell "dir "+d$+":\"+s$+"\"+n$+"."+"f$"+"/b>search\search.txt"

The above syntax should work for almost all the cases, except:
1) When the directory (s$) is the root directory (\). When you build the shell command you'll have \\ together, which won't work. So, test s$ after having input it, and if it's \ convert it to null, like:
if s$="\" then s$=""

2) Another possibility is that the user wants to look at files that don't have a file extension, and specifies null to the file type prompt. Since most directories don't have file extension, they will be included in the output list. To avoid this, after the /b put /a-d which means that you don't want directories.

You also might want to ask the user if he wants to search in sub-directories of the "dir". If so, you would need to insert a "/s" right after the f$ in the shell command string.
*****
Reply
#17
then i have to do this
if s$ = "\" then
goto sub1
else
if s$ = "" then
goto sub1
else
if s$ = " " then
goto sub1
else
shell "dir "+d$+":\"+s$+"\"+n$+"."+f$+"/b>search\search.txt
end
sub1:
shell "dir "+d$+":\"+n$+"."+f$+"/b>search\search.txt
return
Reply
#18
that change dosenot work
Reply
#19
Quote:tannervp, BTW your program is a nice frontend for searching files using the DIR command. Sorry, but I thought you had written an entire utility to do this.

tannervp Wrote:
everett Wrote:
Code:
.....
input "drive"; d$
input "dir"; s$
input "file type"; f$
input "name"; n$
shell "dir d$:\s$n$f$/b > \search\search.txt"
end
maybe it should be shell "dir d$:\s$\n$.f$/b >\search\search.txt"
You got the right idea, except for the way you build the SHELL command string. Take a look at this:

here
shell "dir "+d$+":\"+s$+"\"+n$+"."+"f$"+"/b>search\search.txt"here

The above syntax should work for almost all the cases, except:
1) When the directory (s$) is the root directory (\). When you build the shell command you'll have \\ together, which won't work. So, test s$ after having input it, and if it's \ convert it to null, like:
if s$="\" then s$=""

2) Another possibility is that the user wants to look at files that don't have a file extension, and specifies null to the file type prompt. Since most directories don't have file extension, they will be included in the output list. To avoid this, after the /b put /a-d which means that you don't want directories.

You also might want to ask the user if he wants to search in sub-directories of the "dir". If so, you would need to insert a "/s" right after the f$ in the shell command string.
*****
Reply
#20
Everett,

I read your PM. You're right, my shell doesn't work.

Here's my shell line:
shell "dir "+d$+":\"+s$+"\"+n$+"."+"f$"+"/b>search\search.txt"

It needs to be:
shell "dir "+d$+":\"+s$+"\"+n$+"."+f$+"/b>search\search.txt"

I had quotes around f$. I just tested it, and it works.

I'll leave the other enhancemeents up to you. Let me know how it goes.
*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)