/build/static/layout/Breadcrumb_cap_w.png

Searching and Deleting File/Dir in WiseScript 4.5

How can I search and delete a file, and a directory in a Wise Script without knowing the path to where the file or directory exists?

Wise has the built in Option Delete File, or Delete File/Dir, but that option needs the path like %SYSDRIVE%\Myfile.txt or %SYSDRIVE%\MyDir\*.*

I want to search for a file on my hard drives and if they exist delete them. Same for Directories.

I am new ot WISE any help is greatly appreciated.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: Bladerun 19 years ago
Green Belt
0
There's a search for file command in wise script that will work. Either Search or Find, I don't remember which and my new job doesn't use wise so I can't double check it.


EDIT: Found it. Find File in Path. You can search the entire drive, or limit it to certain directories to speed it up. Note that the command only returns the first file it finds.
Posted by: aek 19 years ago
Purple Belt
0
Thanks. Options for searching and deleting files is built into Wise and you can search for directory if you know the pathname, but
Wise is just wierd for searching for Directories without a pathname.

There could be other methods but I used this to search for my directory. I hope it helps someone.

Eg. If you are looking for a DIR Called Msoffice which is not installed in the root but is in C:\TEMP\ directory, it becomes tough to search for that directory, if you do not know where is it installed and you need to search for that directory.

Solution - Instead of searching for the Dir, you search for a file that you know would be in that Dir.
1) So you first search for Word.exe and get the pathname into a variable
/Use built in Search for File Option
2) Now, If the above Pathname Variable is not ""
/Which would mean that WISE found a path to that File
3) Parse the above Pathname Variable for the Directory name that you are searching and make it stop at the first occurence of that directory name
/Use the built in Parse String Option
4) Parse the above into another variable
This new variable is the path to your search directory

I hope it helps.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ