LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting files

Hi everybody,

I am a LABVIEW newbie. Do you know any lv vi which
will delete a certain types of files in a folder.
For example, the folder contains three files .doc, .txt and
mpeg. If I want to delete .doc file to make room for the next samples,
then every time I execute this vi, all the file with extension .doc
will be deleted. The .txt and .mpeg files will not be effected.

--

Thank you.

Giang
0 Kudos
Message 1 of 19
(20,458 Views)
Giang Linh Le wrote:

> Hi everybody,
>
> I am a LABVIEW newbie. Do you know any lv vi which
> will delete a certain types of files in a folder.
> For example, the folder contains three files .doc, .txt and
> mpeg. If I want to delete .doc file to make room for the next samples,
> then every time I execute this vi, all the file with extension .doc
> will be deleted. The .txt and .mpeg files will not be effected.
>
> --
>
> Thank you.
>
> Giang

Giang,
You can build your own by using the functions in the File I/O pallete
Go to File/I/O "Build path"
Wire the base path (something like C:/mydir/subdir)
Wire a name like *.doc
Go to File I/O->Advanced "Del"
Wire the output of the Build Path to the input of Del
This will delete all of the .doc files in the path you spec
ified.
Kevin Kent
0 Kudos
Message 2 of 19
(20,458 Views)
Hi Kenvin,

Thank you for your suggestion on deleting file.
Can LV accept wildcard * symbol?

Giang
0 Kudos
Message 3 of 19
(20,458 Views)
Giang Linh Le wrote:

> Hi Kenvin,
>
> Thank you for your suggestion on deleting file.
> Can LV accept wildcard * symbol?
>
> Giang

Yes. It actually has nothing to do with Labview since
it actually passes the information to the OS and has the OS delete
the file(s).
You should (as with any delete) be very careful with wild cards
Sending del C:\*.* will kill most of the hard drive NOT A GOOD THING !!
Kevin Kent
0 Kudos
Message 4 of 19
(20,458 Views)
"Kevin B. Kent" wrote:
>This is a multi-part message in MIME format.>--------------1AE9CBE125D6FACF24DFD2F9>Content-Type:
text/plain; charset=us-ascii>Content-Transfer-Encoding: 7bit>>Giang Linh
Le wrote:>>> Hi everybody,>>>> I am a LABVIEW newbie. Do you know any lv
vi which>> will delete a certain types of files in a folder.>> For example,
the folder contains three files .doc, .txt and>> mpeg. If I want to delete
.doc file to make room for the next samples,>> then every time I execute
this vi, all the file with extension .doc>> will be deleted. The .txt and
.mpeg files will not be effected.>>>> -->>>> Thank you.>>>> Giang>>Giang,>You
can build your own by using the functions in the File I/O pallete>Go to File/I/O
"Build path">Wire th
e base path (something like C:/mydir/subdir)>Wire a name
like *.doc>Go to File I/O->Advanced "Del">Wire the output of the Build Path
to the input of Del>This will delete all of the .doc files in the path you
specified.> Kevin Kent>>--------------1AE9CBE125D6FACF24DFD2F9>Content-Type:
text/x-vcard; charset=us-ascii;> name="Kevin.Kent.vcf">Content-Transfer-Encoding:
7bit>Content-Description: Card for Kevin B. Kent>Content-Disposition: attachment;>
filename="Kevin.Kent.vcf">>begin:vcard >n:Kent;Kevin>tel;work:972-477-4468
>x-mozilla-html:TRUE>url:http://www.usa.alcatel.com>org:Alcatel USA;WDCS
Hardware Development>adr:;;;;;;>version:2.1>email;internet:Kevin.Kent@usa.alcatel.com>title:Engineering
Technician>x-mozilla-cpt:;-26944>fn:Kevin Kent>end:vcard>>--------------1AE9CBE125D6FACF24DFD2F9-->


LabVIEW's Delete function won't accept wild-cards.
Message 5 of 19
(20,458 Views)
You can use list directory VI in the File I/O >> Advanced
to find all files matching *.doc pattern, and then wire the
output to the Delete file VI.
Hope this helps

Gorka


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
Message 6 of 19
(20,458 Views)
Gorka Larrea wrote:
>You can use list directory VI in the File I/O >> Advanced>to find all files
matching *.doc pattern, and then wire the>output to the Delete file VI.>Hope
this helps>>Gorka>>>*

You can use "List Directory" with wild-cards to get an array of files but
you'll have to delete them one-by-one since the "Delete" function won't accept
wild-cards.
0 Kudos
Message 7 of 19
(20,458 Views)

Hi,

As you have stated, one should be very careful using the delete file function.

Unfortunately I haven't.

Funny thing is, I deleted about 250 files, about 50 MB but I can't find a trace of any of this data. Apparently it didn't go to the recycle bin, but recovery software like Recuvera couldn't find a trace of the files either. It did find a lot of other files, so I doubt they are gone because of the Windows 7 defragger.

Any suggestions what I can do to find/ recover the files?

0 Kudos
Message 8 of 19
(16,994 Views)

LabVIEW Delete function goes directly to the WinAPI File IO functions. There is no Recycle Bin on that API level. The Windows Recycle Bin is implemented in the Explorer Shell, and as such not part of the WinAPI. It would be possible to send files to the Recycle Bin, but since it is a Windows Explorer functionality that API is much more cumbersome, less stable and more Windows version dependant that the real WinAPI level.

 

The LabVIEW Delete function does nothing special other than calling the according Windows API function to delete the file. As such it should be really equivalent to the del command in the DOS shell and recovery programs should be able to recover some of the data. Not sure why you can't find the data files, unless you wrote some significant data after the delete.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 19
(16,985 Views)

I just wanted to add to this discussion. All the comments here were helpful and I took all of them into account and came up with the attached code.

Message 10 of 19
(12,398 Views)